browserify-bypass
browserify middleware to declare alternative requires for the browser
Last updated 8 years ago by jhnns .
Original npm · Tarball · package.json
$ cnpm install browserify-bypass 
SYNC missed versions from official npm registry.

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");

Current Tags

  • 0.1.0                                ...           latest (8 years ago)

1 Versions

  • 0.1.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |