compile-hook
a tiny, dummy way to add a hook to the Module.prototype._compile method
Install
$ npm i -S compile-hook
Usage
const CompileHook = ; // place the hook:CompileHook; // remove the hookCompileHook; // Place a hook that changes the code on the fly:CompileHook;
GOTCHA
A module that has already been required once will not be hooked again because of the require's cache.
It is possible to remove a module from the cache (remove key in require.cache
) and then require it again.
LICENSE
MIT, see LICENSE file.