When comparing Browserify vs RequireJS, the Slant community recommends Browserify for most people. In the question“What are the best frontend JavaScript module bundlers?” Browserify is ranked 4th while RequireJS is ranked 12th. The most important reason people chose Browserify is:
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.
Ranked in these QuestionsQuestion Ranking
Pros
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.
Pro Works with basically every desktop browser, even IE6
RequireJS supports IE6+, FF2+, Safari3.2+, Chrome3+ & Opera 10+.
Pro Well documented
The RequireJS module loader is extremely well documented. So no matter whether you're a pro at JS based web development or just a newbie, you will find the documentation very helpful whenever you're stuck or just starting out. Everything is well-defined and logically placed in proper sections in a manner such that it is very easy to understand.
Pro You don't need a server to get started
One of the best advantages of RequireJS over Browserify is that you don't need a nodejs environment to get started. Just "require" your dependencies and it takes care of loading them. By contrast, Browserify requires a running NodeJS implementation so you can build your one monolithic file, then you can push the file to your static web server.
Pro Has a RequireJS optimizer
After building all the modules to be loaded, the built files can be optimized as well (minified and concatenated), even though this is a completely optional step, but doing so could be a lot beneficial for your site's performance.
Pro Lazily-loaded JS can access already loaded modules by name
Yet its run-time is still competitive if not better than Webpack's at higher density levels of modules.
Pro Always running site unbundled
With other loaders, aka browserify, it isn't possible to run your site without first bundling. Require.js can load everything async which is pretty powerful.
Pro Supports nested dependencies
If your project has nested dependencies, you won't have to worry about resolving them at all. Because RequireJS will do that for you.
Pro Well tested
Since the RequireJS is quite popular among the dev community, that automatically means that problems get sorted out very quickly and most of the core code has already been tested.
Pro AMD & CJS support
While RequireJS is mainly an AMD implementation, it can, with rare exceptions, implement CJS as well.
Pro Simple
Because of its easy to understand documentation, the RequireJS module loader is super simple to use; module definitions are as easy as defining just a key/value pair.
Pro Can load new modules without being recompiled
It's the one of the few modules in this category that can handle IOC-style dependency injection. The others work well for apps that have knowable dependency lists at compile time, but this is the only one that can load new modules without being recompiled.
Pro Supports hot RE-loading
Persistent console logging, generational statefulness, promotes stateless DOM development.
Cons
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
Con On its way out
Latest stable release is 2 months old with little development occurring on Github.
Con Poor handling of circular references
If you create a circular reference between two files, it will typically quietly break - the reference on one side will end up undefined.
Con AMD spec uses globals
The global ‘require’ and ‘define’ methods make namespace collisions likely if building a 3rd party plugin. AMD loaders line require are best if you control the site.