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
We wrap the function module._compile in order to monitor and replace the compilation of JS files, right before it is being loaded. Using that technique, we can replace the source-code of JS files.
With the new ECMAScript modules, using import from keywords, we are no longer get those invocations, so we can't monitor the module compiling.
Is there any other function that is being called and also exported that we can instrument, in order to "catch" the compilation call?
Note:
We could maybe instrument to a function such as ESMLoader.import, but unfortunately this module is an internal module, lib/internal/process/esm_loader, which is not exported as public to the node.js library and therefore can't be reached.
Thanks,
Niv
The text was updated successfully, but these errors were encountered:
The ESM loader intentionally isn’t exposed for patching the way the CommonJS one was. There is currently no way to achieve what you’re requesting, though there are efforts to try to support what we’ve been calling hot reloading: nodejs/loaders#22. It’s one of the use cases that ES module loaders aim to support, though there’s a lot to build before it can be achieved so it won’t be implemented soon.
We wrap the function
module._compile
in order to monitor and replace the compilation of JS files, right before it is being loaded. Using that technique, we can replace the source-code of JS files.With the new ECMAScript modules, using
import from
keywords, we are no longer get those invocations, so we can't monitor the module compiling.Is there any other function that is being called and also exported that we can instrument, in order to "catch" the compilation call?
Note:
We could maybe instrument to a function such as
ESMLoader.import
, but unfortunately this module is an internal module,lib/internal/process/esm_loader
, which is not exported as public to the node.js library and therefore can't be reached.Thanks,
Niv
The text was updated successfully, but these errors were encountered: