Skip to content

Instantly share code, notes, and snippets.

@vdeturckheim
Last active February 23, 2017 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdeturckheim/5f3bad8b67a9b6fce2a0e62b0bbe3933 to your computer and use it in GitHub Desktop.
Save vdeturckheim/5f3bad8b67a9b6fce2a0e62b0bbe3933 to your computer and use it in GitHub Desktop.
const Module = require(‘module’); // this is a module from Node.js core library
Const load = Module._load;
Module._load = function (request, parent) {
const mod = load.apply(this, arguments); // load the module with the original method
// add hooking logic here
keepTrackOfImport(mod, request, parent);
return mod;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment