browserify-bypass

    0.1.0 • Public • Published

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

    Keywords

    none

    Install

    npm i browserify-bypass

    DownloadsWeekly Downloads

    0

    Version

    0.1.0

    License

    none

    Last publish

    Collaborators

    • jhnns