Follow these instructions and in less than 10 minutes you will have Browserify installed and ready to go.

1) Install Browserify globally

npm install -g browserify

2) Create a main.js file and start writing your code

var _ = require('lodash');

var chunked = _.chunk(['a', 'b', 'c', 'd'], 2);

console.log(chunked); // → [['a', 'b'], ['c', 'd']]

3) Use npm to install your dependencies

npm install --save lodash

4) Use browserify to package your code

browserify main.js -o bundle.js

5) Drop bundle.js in your html code and you are ready to go !

Browserify automatically found and included all the required dependencies in bundle.js.

6) Advantages

  • You only need to require one JavaScript file in your code
  • You can manage your client side dependencies with npm
  • You can manage your dependencies easily like you would in Node.