node
node copied to clipboard
esm: remove CLI flag limitation to programmatic registration
This is a follow-up to https://github.com/nodejs/node/pull/46826
We see 2 potential approaches here when we detect a user is trying to register a loader and the worker etc have not be set up:
- Replace the existing
DefaultModuleLoaderwith aCustomizedModuleLoader - Merge the two ModuleLoaders back together and trigger setups when certain methods are called (eg
ModuleLoader::register())
The first seems the simplest. However, it's currently facing an issue where ModuleJob maintains a reference to the loader that instantiated it; in option 1, that reference becomes stale. Further work to be done is to sever their direct connection.
Review requested:
- [ ] @nodejs/loaders
- [ ] @nodejs/modules