ignorify

Browserify middleware that allows to specify ignore rules in source code

node-ignorify

Browserify middleware that allows to specify ignore rules in source code

$ npm install ignorify

Just throw the ignorify tag before the require statement you want to be ignored by browserfy.

//@browserify-ignore 
var foo = require('./dontrequireit');

Then, during the bundling specify the ignorify middleware :

var browserify = require('browserify');
var ignorify = require('ignorify');
 
var bundle = browserify();
bundle.register(ignorify);
bundle.addEntry('./index.js');
bundle.bundle();

Or :

$ browserify entry.js -p 'ignorify' -o browserify.js
$ npm test