-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adapt mjs bundle for nodejs v12 (#828)
- Loading branch information
1 parent
73f0558
commit b3fcad2
Showing
3 changed files
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
import { createRequire } from 'node:module' | ||
|
||
const require = createRequire(import.meta.url) | ||
const __filename = new URL(import.meta.url).pathname | ||
const __dirname = new URL('.', import.meta.url).pathname | ||
|
||
if (globalThis.Deno) { | ||
globalThis.require = createRequire(import.meta.url) | ||
globalThis.__filename = new URL(import.meta.url).pathname | ||
globalThis.__dirname = new URL('.', import.meta.url).pathname | ||
globalThis.require = require | ||
globalThis.__filename = __filename | ||
globalThis.__dirname = __dirname | ||
} | ||
|
||
export { require, __dirname, __filename } |