You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] [safari] Causes a let declaration Syntax Error in Safari. #681
I'm currently on node-minify 2.3.0 (I'm using very recent versions of Rollup and rollup-plugin-babili to make these files, and I see node-minify in my node_modules).
We have hit this bug before and had a workaround which fixes this issue on safari #567. The fix has been released as part of 0.1.3
Also i see that your code contains both var and let declarations and I am not sure whether that is causing the issue. Could you tell me how you are using this?
All vars (except for some vars I use used in the top level of modules for module export hoisting) are either from other node_modules or from build output during my Rollup+Buble transpile/bundle step.
I have run into this as well. Here's one example of the code that looks like it would cause problems: (my error is SyntaxError: Cannot declare a let variable twice: 'n'.)
Activity
trusktr commentedon Aug 29, 2017
Additionally, you can reproduce by simply pasting the minified code in your Safari console.
trusktr commentedon Aug 29, 2017
I'm currently on node-minify 2.3.0 (I'm using very recent versions of Rollup and rollup-plugin-babili to make these files, and I see node-minify in my node_modules).
vigneshshanmugam commentedon Aug 29, 2017
We have hit this bug before and had a workaround which fixes this issue on safari #567. The fix has been released as part of 0.1.3
Also i see that your code contains both
varandletdeclarations and I am not sure whether that is causing the issue. Could you tell me how you are using this?trusktr commentedon Aug 29, 2017
All vars (except for some vars I use used in the top level of modules for module export hoisting) are either from other node_modules or from build output during my Rollup+Buble transpile/bundle step.
Basically, what I am doing is
npm run build-globalin http://GitHub.com/trusktr/infamous which basically does (with Rollup+Buble) what is configured in rollup.config.js.trusktr commentedon Aug 29, 2017
This outputs the global.js file you see in that repo. If you comment out the lines that use
babiliyou can disable minification.target IE 11 with Rollup to avoid a Safari problem. That sounds stran…
trusktr commentedon Aug 30, 2017
As a quickfix, I can just set the target to
ie:10and the Safari is able to run the code with no errors.This is the minified code targetting ie10:
https://cdn.rawgit.com/trusktr/3248affba4a01a7ebf15f3cb0e68f18c/raw/09ee1b15b982ab1048a8efaff857149396adf7fc/minified-target-ie10.js
And here's a pen with minified code now working in Safari:
https://codepen.io/anon/pen/EvOpNq?editors=0010
I've just gotta run my tests to make sure nothing broke due to variable shadowing, but I bet Buble probably handled this.
Oliboy50 commentedon Sep 21, 2017
I'm using
babel-preset-minifyversion0.2.0and the bug still occurs on Mac OS El Capitan - Safari 10.1.1 and on iOS 10.3.3 - Safari.So the fix mentioned by @vigneshshanmugam in
0.1.3does not seem to fix it.Here is my error message :
(if you want to see my code, here you go => https://github.com/LinkValue/Appbuild/blob/master/webpack.config.js#L137)
As a workaround, i've set
mangle: falsein babel-preset-minify options... and it works, but it obviously makes my files bigger.boopathi commentedon Oct 25, 2017
@trusktr @Oliboy50
Can you give a minimal repro version of your code?
marmanold commentedon Oct 31, 2017
I'm experiencing this issue, too.
feuerste commentedon Nov 3, 2017
I have this issue, too. It seems to appear when mangling following file:
https://github.com/Polymer/polymer/blob/master/lib/mixins/property-accessors.html
JakeDluhy commentedon Nov 10, 2017
I have run into this as well. Here's one example of the code that looks like it would cause problems: (my error is
SyntaxError: Cannot declare a let variable twice: 'n'.)unminified:
I also believe this would cause a problem too:
I hope this helps!
LinusU commentedon Jun 21, 2018
This is a bug in Safari 10.x:
https://bugs.webkit.org/show_bug.cgi?id=171041
Uglify is working around the bug:
mishoo/UglifyJS#1753
Would be very nice if we could do the same here, this is currently affecting me in production 😱
Here is the commit that added the workaround to Uglify:
mishoo/UglifyJS@fcd90db