You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On node nightly, use node --loader ./loader.mjs ./index.mjs
Within index.mjs, call import {runMain} from 'module'; runMain() and then do something that uses loader hooks, such as importing or calling import.meta.resolve(). The hooks in loader.mjs have been duplicated in the chain and thus will be called more than they should.
The linked reproduction demonstrates this by implementing a loader hook that logs a message and delegates to the next hook in the chain.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Module.runMain understands if the loader hooks have already been initialized and does not duplicate them in the chain.
What do you see instead?
Module.runMain duplicates all loaders in the chain.
Additional information
No response
The text was updated successfully, but these errors were encountered:
Version
v19.0.0-nightly202207093d575a4f1b
Platform
Linux DESKTOP-5K7R6JP 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Detailed reproduction here:
https://github.com/cspotcode/repros/tree/node-loader-chaining-duplication
On node nightly, use
node --loader ./loader.mjs ./index.mjs
Within
index.mjs
, callimport {runMain} from 'module'; runMain()
and then do something that uses loader hooks, such as importing or callingimport.meta.resolve()
. The hooks inloader.mjs
have been duplicated in the chain and thus will be called more than they should.The linked reproduction demonstrates this by implementing a loader hook that logs a message and delegates to the next hook in the chain.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Module.runMain
understands if the loader hooks have already been initialized and does not duplicate them in the chain.What do you see instead?
Module.runMain
duplicates all loaders in the chain.Additional information
No response
The text was updated successfully, but these errors were encountered: