When comparing Webpack vs Browserify, the Slant community recommends Webpack for most people. In the question“What are the best frontend JavaScript module bundlers?” Webpack is ranked 1st while Browserify is ranked 4th. The most important reason people chose Webpack is:
Plugins and loaders are easy to write and allow you to control each step of the build, from loading and compiling CoffeeScript, LESS and JADE files to smart post processing and asset manifest building.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Rich and flexible plugin infrastructure
Plugins and loaders are easy to write and allow you to control each step of the build, from loading and compiling CoffeeScript, LESS and JADE files to smart post processing and asset manifest building.
Pro Tap into npm's huge module ecosystem
Using Webpack opens you up to npm, that has over 80k modules of which a great amount work both client-side and server-side. And the list is growing rapidly.
Pro Can create a single bundle or multiple chunks loaded on demand, to reduce initial loading time
Webpack allows you to split your codebase into multiple chunks. Chunks are loaded on demand. This reduces the initial loading time.
Pro Supports source maps for easier debugging
Source maps allow for easier debugging, because they allow you to find the problems within the origin files instead of the output file.
Pro ES6 module support
Webpack supports ES6 modules and their import
and export
methods without having to compile them to CommonJS require
Pro Share the same modules client-side and server-side
Because Webpack allows you to use the same require() function as node.js, you can easily share modules between the client-side and server-side.
Pro Bundles CommonJs and AMD modules (even combined)
Webpack supports AMD and CommonJS module styles. It performs clever static analysis on the AST of your code. It even has an evaluation engine to evaluate simple expressions. This allows you to support most existing libraries.
Pro Mix ES6 AMD and CommonJS
Webpack supports using all three module types, even in the same file.
Pro Limit plugin integration issues
Pro Tap into npm's huge module ecosystem
Using browserify opens you up to npm, that has over 80k modules of which a great amount work both client-side and server-side. And the list is growing rapidly.
Pro Simple to use dependency management
To require a file, just use the require() function.
var foo = require('./foo.js');
These files may have dependencies of their own. Browserify will build a dependency graph and bundle it into a single file that you just have to put in a script tag.
<html>
<body>
<script src="bundle.js"></script>
</body>
</html>
Pro Share the same modules client-side and server-side
Because browserify allows you to use the same require() function as node.js, you can easily share modules between the client-side and server-side.
Pro Provides browser-friendly shims of Node modules
Browserify provides browser-friendly shims of Node modules, that allow for things like Node event systems, path parsing, URL parsing.
Pro deAMDify & debowerify allow using modules written for other systems
Browserify includes transforms such as deAMDify, that allow you to use modules written in the AMD module format, and debowerify, that allows you to use modules intended to be managed by Bower package manager.
Pro CJS module format
Pro Friendly plugin interface
Writing plugins is relatively easy and straight forward as each file, you can run a function that gives a file name and path, based on that you can decide if you want to do something like parse, transform, modify etc the file or skip it.
Cons
Con Config file may be hard to understand
Due to a somewhat hard to grasp syntax, configuring Webpack may take some time.
Con Can not load files discovered during runtime
Con Requires NodeJS environment just to get in the door
Browserify does nothing client-side. It's only a server-side builder. If you want to load files from other domains, look at RequireJS. If you want to break your code up into multiple modules, look at RequireJS or Webpack.
Con Requires a lot of magic for setup
Digging for high amount of modules