🐛 Fix fetch resolver

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

View file

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