-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
esm: make dynamic import work in the REPL
PR-URL: #29437 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: David Carlier <devnexen@gmail.com>
- Loading branch information
1 parent
63b056d
commit cdebd32
Showing
2 changed files
with
37 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const { spawn } = require('child_process'); | ||
|
||
const child = spawn(process.execPath, [ | ||
'--experimental-modules', | ||
'--interactive' | ||
]); | ||
child.stdin.end(` | ||
import('fs').then( | ||
ns => ns.default === require('fs') ? 0 : 1, | ||
_ => 2 | ||
).then(process.exit) | ||
`); | ||
|
||
child.on('exit', (code) => { | ||
assert.strictEqual(code, 0); | ||
}); |