derequire

remove requires

npm install derequire
2 954 downloads in the last day
13 855 downloads in the last week
64 363 downloads in the last month

derequire

npm install derequire
var derequire = require('derequire');
var transformedCode = derequire(code, /*tokenTo=*/'_dereq_', /*tokenFrom=*/'require');

takes a string of code and replaces all instances of the identifier tokenFrom (default 'require') and replaces them with tokenTo (default '_dereq_') but only if they are functional arguments and subsequent uses of said argument, then returnes the code.

Note: in order to avoid quite a few headaches the token you're changing from and the token you're changing to need to be the same length.

npm loves you