node package manager

monobrow

monobrow

browserify, with opinions.

Usage

First add to your project:

npm install --save-dev monobrow

Then write a js module to build your project. For example, a simple one looks like this:

// your-project/monobrow/config.js 
 
module.exports = {
  entry: 'src/index.js',
  output: {
    dir: 'build'
  }
}

Then add a script to your package.json:

"scripts"{
  "build": "monobrow"
}

And npm run build

You can also npm run build -- -w to watch, or npm run build -- -h to hot-reload.

You can also specify hostname for the hot reload server: npm run build -- -h 127.0.0.1. If you supply -h (or --hot) with no value, the default hostname of 0.0.0.0 is used.

Simple bundle splitting

If you specify the output.vendor config, any packs that provide vendors can externalize them into a separate bundle. Eg.

// your-project/monobrow/config.js 
 
module.exports = {
  entry: 'src/index.js',
  output: {
    dir: 'build',
    vendor: 'vendor.js'
  }
}

This will produce 2 files in the build directory:

  • build/index.js: just your application bundle
  • build/vendor.js: a bundle with externalized vendor files

When you do this, don't forget to add a new <script src="dist/vendor.js"></script> to your page, before the <script> tag that includes your application bundle.

Tech

Example

Take a look at monobrow-todomvc to see a simple example of:

  • splitting app code and dependencies into separate bundles
  • adding transforms (eg. babelify)

License

MIT