NODE_ENV=production browserify src/main.js -t babelify -g envify -v -p bundle-collapser/plugin -p [minifyify --no-map --uglify [ --compress [ --dead_code ] --mangle ] ] | uglifyjs -m -e -c dead_code,screw-ie8,warnings=false > build/bundle.js
But passing all the uglify options twice feels wrong.
I would like it to look more like:
watchify src/main.js -t babelify -g envify -p uglify -o build/bundle.js -v
gulp.task('js:compile', function() {
return browserify([ deployDir + '/js/pages/newModelVisualization.js'
], { debug: true })
.transform(babelify,{presets: [__dirname + "/node_modules/babel-preset-es2015-nostrict"]})
.bundle()
.pipe(source('modelerWizardFlow-min.js'))
.pipe(gulp.dest('.'))
})
events.js:160
throw er; // Unhandled 'error' event
^
Error: Cannot find module 'underscore' from '/home/velvet/tf/src-docroot/js/lib'
at /home/velvet/tf/frontend/node_modules/resolve/lib/async.js:46:17
at process (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:173:43)
at ondir (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:188:17)
at load (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:69:43)
at onex (/home/velvet/tf/frontend/node_modules/resolve/lib/async.js:92:31)
at /home/velvet/tf/frontend/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
import { _ } from './lib/underscore.js'
require('my-project')
to /local/path/to/my-project
ERROR: Cannot find module './modules/es6.string.fontsize'
)
browserify is still awesome.
I was making a card for my dad for fathers day, in code of course, & since I spent a fair bit the time on the card, I didn't have any to waste on a build system.
browserify -t [ browserify-css --autoInject=true ] --entry js/main.js -o index.browserified.js
index file with all the codes, full of the win.