mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-01 20:46:08 +00:00
fix: try require first
This commit is contained in:
parent
e41711770c
commit
61c3c283b9
@ -279,7 +279,12 @@ export const ReplaceRegex = {
|
||||
};
|
||||
|
||||
export async function magicImport(path: string) {
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user