deepak1556 / gulp-browserify

Bundle modules with BrowserifyJS
MIT License
195 stars 45 forks source link

shim breaks when invoked multiple times by gulp (close #62) #65

Open darwin opened 10 years ago

darwin commented 10 years ago

Shim config gets mutated when shim transformation is called. Multiple invocations cause single file to be wrapped multiple times, which breaks the wrapping functionality and leads to very cryptic javascript errors.

This problem gets exposed for example using shims together with file watching. https://github.com/FrenkyNet/gulp-browserify-bug-62/blob/master/gulpfile.js

deepak1556 commented 10 years ago

Thanks, But doesnt seem to fix the problem. Any suggestions ?

darwin commented 10 years ago

Well, maybe we both speak about different problem :) This definitely fixed the issues in my case of using gulp watcher with gulp-browserify, which had config passed as a separate pre-constructed object (now I see it does not match the linked example), so maybe there are more separate bugs.

My bug was caused by you modifying opts object every time browserify is called. If I always construct config object from scratch it works, but when I pass existing object and reuse it between invocations it breaks.