I have the following modules installed:
- babelify
- babel-preset-es2015
- browserify
- uglifyify
Now I have a core file server.js which contains ES6 javascript. I can convert the ES6 to ES5 and bundle the code for browsers with the following command:
browserify server.js -o ./public/bundle.js -t [ babelify --presets [es2015] ]
But now I want to get uglifyify minifying the code and adding a source map. I can't get this working, I just can't work out the correct command. I've tried the following:
browserify server.js -t uglifyify -t [ babelify --presets [es2015] ] -o ./public/bundle.js
browserify server.js -o ./public/bundle.js -t [ uglifyify, babelify --presets [es2015] ]
browserify server.js uglifyify -o ./public/bundle.js -t [ babelify --presets [es2015] ]
and even without babel:
browserify server.js -o ./public/bundle.js -t uglifyify
browserify server.js -t uglifyify -o ./public/bundle.js
-gwithnpm). If it helps, this is working for me in a script:NODE_ENV=production browserify -t [ babelify --presets [ es2015 react ] ] -g uglifyify scripts/index.jsx -o bundle.jsI still need something else like uglifyjs for better compression though. Haven't worked that in yet. - juanitogan