From 61c3c283b9c92c29981ad9dcc954116251f415f4 Mon Sep 17 00:00:00 2001 From: MARCROCK22 Date: Tue, 18 Feb 2025 20:52:06 -0400 Subject: [PATCH] fix: try require first --- src/common/it/utils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/common/it/utils.ts b/src/common/it/utils.ts index fb505b8..ed97ba0 100644 --- a/src/common/it/utils.ts +++ b/src/common/it/utils.ts @@ -279,7 +279,12 @@ export const ReplaceRegex = { }; export async function magicImport(path: string) { - return new Function('path', 'return import(`file:///${path}?update=${Date.now()}`)')(path); + try { + if ('Deno' in globalThis) throw new Error('https://github.com/denoland/deno/issues/26136'); + return require(path); + } catch { + return new Function('path', 'return import(`file:///${path}?update=${Date.now()}`)')(path); + } } export type OnFailCallback = (error: unknown) => any;