{
"main": "./js/entry.js",
"browser": {
"jquery": "./js/vendor/jquery.js"
},
"browserify-shim": {
"jquery": "$",
"three": "global:THREE"
},
"browserify": {
"transform": [ "browserify-shim" ]
},
"dependencies": {
"browserify-shim": "~3.2.0"
}
}
jquery
from the a js file the user maintains. I'd rather just use the browserified module and install and maintain it via npm install jquery
...
"jquery-ui": {
"depends": [
"jquery:jQuery"
]
},
...
b.pipeline
or b.pipeline.get('wrap')
? See: https://github.com/zoubin/factor-vinylify/pull/1#discussion_r63813785
require('net')
to return something particular after bundling. There is documentation that alludes to this being possible, but I honestly can't understand what incantation to use. I'd greatly appreciate any hints. Thanks.
React
whenever require('react')
is called?
module.exports = React
or something?
browserify-shim: { 'foo': 'global:Foo' }
browserify-shim: { 'mod': { depends: "foo" }}
Hi, I am working on a pretty simple project using React with babel and browserify. I am struggling to get proper minification/uglification working.
I already tried using minifyify and uglifyify. But there are still a lot of line breaks in the final file and overall the result seems still to large.(~300-400kb)
When using minifyify and then apply to uglifyjs2 to the output the file size goes down to ~200kb.
But it feels pretty redundant and does not work with watchify.
So I guess my question is: When using babel/browserify/watchify via cli, what's the best and simplest way to do minification?
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)