How to get minified output with browserify? How to get minified output with browserify? javascript javascript

How to get minified output with browserify?


Pipe it through uglifyjs:

 browserify main.js | uglifyjs > bundle.js

You can install it using npm like so:

 npm install -g uglify-js


As of 3.38.x you can use my minifyify plugin to minify your bundle and still have usable sourcemaps. This is not possible with the other solutions -- the best you can do is map back to the uncompressed bundle. Minifyify maps all the way back to your separate source files (yes, even to coffeescript!)


Or use uglifyify transform which "gives you the benefit applying Uglify's "squeeze" transform before it's processed by Browserify, meaning you can remove dead code paths for conditional requires."