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