Closed mlms13 closed 10 years ago
This might be relevant to #52. If so, it is a bug of node-browserify
's dependencies.
@mlms13 Does it work if you use node-browsrify
's command line tool?
Using node-browserify
3.28.2 from the command line like this: browserify js\foo.js > build\js\foo.js
I end up with a working file that is 6 lines (621 bytes) instead of the 1300 line (38kb) file I get with gulp-browserify
. Am I doing something terribly wrong?
1300 lines might be caused by insertGlobals flag. If it is set, browserify inserts global functions and objects even if they are not used at all. That boosts bundling speed because browserify doesn't need check if the code uses globals or not. So, you may see the same result if you set it false on gulp or add --insert-globals option to the commandl line.
@mlms13 If this is the same issue as #54, it will be fixed as soon as browserify's dependencies are fixed. For the time being, turning off insertGlobals
option will make it work.
Woops, I never responded. But you're right, turning off insertGlobals
did the trick for now. #52 definitely looks like the same issue, so you can close this one if you want. Thanks for looking into it and following up. :)
Thanks for your response! Closing.
Consider the following reduced test case:
foo.js
bar.js
Using gulp-browserify 0.4.4, with this as my gulpfile:
on Windows, the output includes
And when I try to load the JS file in the browser, I get the following error:
This issue does not exist when building with gulp-browserify 0.4.3. I'm not sure if this is the equivalent line in the compiled output, but if so, it looks like this:
Has something changed in the way I should be using gulp-browserify with version 0.4.4, or is this a bug?