browserify-override

Browserify middleware for local overrides

npm install browserify-override
32 downloads in the last month

Browserify middleware for local customization of a compilation.

Installation

$ npm install browserify-override

Usage

browserify-override is a browserify middleware :

var b = require('browserify')();
b.use(require('browserify-override').rules({
  'sasl.js': {
    action: 'patch',
    rules: [{
      from: 'console.log',
      to: '//console.log'
    }]
  },
  'net.js': {
    action: 'replace',
    with: 'net.js',
    from: module
  },
  'dns': {
    action: 'define',
    with: 'dns.js',
    from: module
  },
  'element.js': {
    action: 'append',
    with: 'element.js',
    from: module
  }
}));

If rules are not explicitly provided, browserify-override will require("rules.js"), allowing you to set rules in a rules.js file in a valid node_modules folder.

Example

The canonical example of browserify-override, is the modifications in UProxy, which patchs the node-xmpp code-base to run as a chrome application based on the chrome.socket API.

Licence

MIT

npm loves you