Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Browsers don't have the require method defined, but Node.js does. With Browserify you can write code that uses require in the same way that you would use it in Node. Install the uniq module with npm. Now recursively bundle up all the required modules starting at main.js into a single file called bundle.js with the browserify command. Browserify parses the AST for require() calls to traverse the entire dependency graph of your project. Drop a single <script> tag into your html and you're done! browserify is a tool for compiling node-flavored commonjs modules for the browser. You can use browserify to organize your code and use third-party libraries even if you don't use node itself in any other capacity except for bundling and installing packages with npm.
Features
- Use many of the tens of thousands of modules on NPM in the browser
- Use watchify, a browserify compatible caching bundler, for super-fast bundle rebuilds as you develop
- Use tinyify for optimized, tree-shaked bundles in production environments
- Use --debug when creating bundles to have Browserify automatically include Source Maps for easy debugging
- Check out tools like Beefy or run-browser which make automating browserify development easier
- Get browser versions of the node core libraries events, stream, path, url, assert, buffer, util, querystring, http, vm, and crypto when you require() them