File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
packages/quicktype-core/src/input/io Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import * as fs from "fs";
22
33import { defined , exceptionToString } from "@glideapps/ts-necessities" ;
44import { isNode } from "browser-or-node" ;
5- import _fetch from "cross-fetch" ;
65import isURL from "is-url" ;
76import { type Readable } from "readable-stream" ;
87
@@ -11,10 +10,9 @@ import { panic } from "../../support/Support";
1110
1211import { getStream } from "./get-stream" ;
1312
14- // Only use cross-fetch in CI
15- // FIXME: type global
16- // eslint-disable-next-line @typescript-eslint/no-explicit-any
17- const fetch = process . env . CI ? _fetch : ( global as any ) . fetch ?? _fetch ;
13+ // We need to use cross-fetch in CI or if fetch is not available in the global scope
14+ // We use a dynamic import to avoid punycode deprecated dependency warning on node > 20
15+ const fetch = process . env . CI ? require ( "cross-fetch" ) . default : ( global as any ) . fetch ?? require ( "cross-fetch" ) . default ;
1816
1917interface HttpHeaders {
2018 [ key : string ] : string ;
You can’t perform that action at this time.
0 commit comments