Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var Module = require('module');
var old_wrap_zero = Module.wrapper[0];
// some code to inject into a module load.
var code = '\n(' + (function (){
process.NativeModule = require('native_module');
}) + ')();\n';
Module.wrapper[0] += code;
// http is lazy loaded
var http = require('http');
// reset module wrpper
Module.wrapper[0] = old_wrap_zero;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment