From 0a460c6a7c54bec4a7539ca236fd4d1075b02dc0 Mon Sep 17 00:00:00 2001 From: DevAndromeda <46562212+DevAndromeda@users.noreply.github.com> Date: Tue, 19 Jul 2022 20:28:21 +0545 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20fetch=20resolver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/Util.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/Util.ts b/src/utils/Util.ts index 5d8e592..d976a12 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -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? + } } } }