- Version: v14.0.0-pre / cf5ce2c
- Platform:
Linux lt2.cfware.com 5.3.11-200.fc30.x86_64 #1 SMP Tue Nov 12 19:25:25 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: repl, CLI
--eval and --print without --input-type=module
Create script.mjs:
console.log('script.mjs', typeof require);
Running node ./script.mjs or node --input-type=module --eval "import('./script.mjs')" both produce the correct output script.mjs undefined.
Now run import('./script.mjs') in repl, this produces output script.mjs function. Same for node --eval "import('./script.mjs')".
Using --print in place of --eval does not change typeof require.
CC @nodejs/modules-active-members
Linux lt2.cfware.com 5.3.11-200.fc30.x86_64 #1 SMP Tue Nov 12 19:25:25 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux--evaland--printwithout--input-type=moduleCreate
script.mjs:Running
node ./script.mjsornode --input-type=module --eval "import('./script.mjs')"both produce the correct outputscript.mjs undefined.Now run
import('./script.mjs')in repl, this produces outputscript.mjs function. Same fornode --eval "import('./script.mjs')".Using
--printin place of--evaldoes not changetypeof require.CC @nodejs/modules-active-members