🐛 Fix fetch resolver

This commit is contained in:
DevAndromeda 2022-07-19 20:28:21 +05:45
parent 430d18ea3b
commit 0a460c6a7c

View file

@ -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?
}
}
}
}