- Version: 14.2.0
- Platform: MacOS
- Subsystem: ESM
What steps will reproduce the bug?
- Create an empty
loader.mjs:
console.log('loader loaded')
- Create a file
foo.js to be executed:
console.log('foo loaded')
- Now run
foo.js with the loader:
node --loader=./empty.mjs foo.js
As expected, it will print both loader loaded and foo loaded
- Now run
foo.js, but using -e:
node --loader=./empty.mjs -e 'require("./foo.js")'
Only foo loaded is run, whereas I would expect loaded loaded to also be printed.
node --loader=./empty.mjs -e 'import("./foo.js")'
This also prints only foo loaded, which means that it's not lazy loading of the loader.
How often does it reproduce? Is there a required condition?
Consistently
What is the expected behavior?
The loader should be loaded even when using -e.
What do you see instead?
Loader is not loaded when using -e.
What steps will reproduce the bug?
loader.mjs:foo.jsto be executed:foo.jswith the loader:As expected, it will print both
loader loadedandfoo loadedfoo.js, but using-e:node --loader=./empty.mjs -e 'require("./foo.js")'Only
foo loadedis run, whereas I would expectloaded loadedto also be printed.node --loader=./empty.mjs -e 'import("./foo.js")'This also prints only
foo loaded, which means that it's not lazy loading of the loader.How often does it reproduce? Is there a required condition?
Consistently
What is the expected behavior?
The loader should be loaded even when using
-e.What do you see instead?
Loader is not loaded when using
-e.