I'm unable to build a project that has firebase as an import. It looks like some of the build steps are preprocessing imported modules in a way that's breaking uglify.
Environment:
Reproduction steps:
$ preact create sample
$ cd sample
$ yarn add firebase
$ edit src/index.js # Add: import firebase from 'firebase';
$ yarn run build
yarn run v0.24.5
$ preact build
bundle.js from UglifyJs
Unexpected token: punc ()) [bundle.js:5468,33]
✨ Done in 6.07s.
Here's a copy of the bundle.js. Note the () on line 5470 around char 33.
CC @addyosmani @jshcrowthe
function ka(a,b,c){if(!a)throw Error(); get's transformed to function ka(a,b,c){if(!a)return;(); because of ReplacePlugin in webpack config.
@developit is there a way to actually limit it to babel-helpers? I don't think it's a good idea to remove all errors - I mean we all like to throw some errors around when things go south 😅
Oh, nice catch! Went through the plugin source, and there's no option for specifying a file or dir-specific replacement. If anything is possible, it'd have to be thru a webpack context loader...maybe? That, or fork the plugin. It's been idle for a while anyway.
@lukeed is correct in that plugin doesn't appear to have been active for over a year (no replies to the open PR in that timespan either). If we go down the direction of forking it to address this that doesn't sound like the worst idea :)
Perhaps there's a cleaner way to limit this to babel-helpers though without needing to do that.
This is something I can take on, and better yet, can justify spending time on it with work.
I see I'm not the only Googler running into this. Hi @addyosmani, hi @jmadler :wink:
I have time set aside for this tomorrow. New plugin out shortly folks.
Fix released in 1.1.1! :)
Most helpful comment
I see I'm not the only Googler running into this. Hi @addyosmani, hi @jmadler :wink: