Skip to content

Commit

Permalink
fix: use globalThis.require
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist authored Jan 30, 2022
1 parent b53b134 commit dd96549
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const dynamicImport: RequireFunction = async (
const fn =
format === "esm"
? (file: string) => import(file)
: typeof require === "function"
? require
: typeof globalThis.require === "function"
? globalThis.require
: createRequire(import.meta.url)
return fn(id)
}

0 comments on commit dd96549

Please sign in to comment.