-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixup! fixup! module: add __esModule to require()'d ESM
- Loading branch information
1 parent
911bbb3
commit ae54d52
Showing
2 changed files
with
19 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
// Flags: --experimental-require-module | ||
'use strict'; | ||
const common = require('../common'); | ||
const mod = require('../fixtures/es-modules/export-es-module.mjs'); | ||
|
||
// If an ESM already defines __esModule to be something else, | ||
// require(esm) should allow the user override. | ||
common.expectRequiredModule( | ||
mod, | ||
{ default: { hello: 'world' }, __esModule: 'test' }, | ||
false, | ||
); | ||
{ | ||
const mod = require('../fixtures/es-modules/export-es-module.mjs'); | ||
common.expectRequiredModule( | ||
mod, | ||
{ default: { hello: 'world' }, __esModule: 'test' }, | ||
false, | ||
); | ||
} | ||
|
||
{ | ||
const mod = require('../fixtures/es-modules/export-es-module-2.mjs'); | ||
common.expectRequiredModule( | ||
mod, | ||
{ default: { hello: 'world' }, __esModule: false }, | ||
false, | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const __esModule = false; | ||
export default { hello: 'world' }; |