🐛 Fix fetch resolver
This commit is contained in:
parent
430d18ea3b
commit
0a460c6a7c
1 changed files with 6 additions and 4 deletions
|
@ -98,12 +98,14 @@ class Util {
|
||||||
|
|
||||||
static async getFetch() {
|
static async getFetch() {
|
||||||
if ("fetch" in globalThis) return globalThis.fetch;
|
if ("fetch" in globalThis) return globalThis.fetch;
|
||||||
|
for (const lib of ["undici", "node-fetch"]) {
|
||||||
try {
|
try {
|
||||||
return await import("undici").then((res) => res.default);
|
return await import(lib).then((res) => res.fetch || res.default?.fetch || res.default);
|
||||||
} catch {
|
} catch {
|
||||||
// uh?
|
// uh?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export { Util };
|
export { Util };
|
||||||
|
|
Loading…
Reference in a new issue