browserify-bypass
v0.1.0
Published
browserify middleware to declare alternative requires for the browser
Downloads
1
Readme
browserify-bypass
A node.js browserify middleware to declare alternative requires for the browser.
Installation
npm install browserify-bypass
Example
To declare an alternative require for the browser write // @browser ./path/to/browserModule.js
one line above the
require statement:
// @browser ./browserModule.js
var myModule = require("./nodeModule.js"),
// @browser ./anotherBrowserModule.js
anotherModule = require("./anotherNodeModule.js");
To generate the browserified module just do this:
var b = require("browserify");
b(); // init browserify with default options
b.use(require("browserify-bypass"));
b.require("./testModule.js");
The browserified module will now look like this:
var myModule = require("./browserModule.js"),
anotherModule = require("./anotherBrowserModule.js");