bdkjones / CodeKit2

CodeKit 2 Beta
97 stars 4 forks source link

The currently used version of Uglify mangles vars to letters that cause errors in Safari #623

Closed binomialstew closed 8 years ago

binomialstew commented 8 years ago

I am prepending 6 or 7 vendor libraries to my js file using CodeKit's in-file prepends—minifying the resulting js with CodeKit.

I'm seeing this error in Safari—preventing the page from fully loading: app.min.js:5SyntaxError: Cannot declare a parameter named 'i' as it shadows the name of a strict mode function.

I'm pretty sure this is the same issue documented here: mishoo/UglifyJS2#179

It appears this was fixed in an earlier version of Uglify than what I see is being used in CodeKit's about page - Uglify 2.6.2

So, I am not really sure what the problem is, actually.

As a temporary solution, is there any way I can set this to avoid using specific vars when minifying (while still minifying)?

I'm currently using CodeKit version 2.8 (19127)

bdkjones commented 8 years ago

Interesting. I'll have to update the Uglify version bundled in CodeKit. I'll try to do that tonight.

binomialstew commented 8 years ago

That would be awesome, but I am confused because the version of Uglify used by CodeKit seems to be more recent than the versions of Uglify with the bug I linked.

binomialstew commented 8 years ago

I can confirm the latest version of Uglify (2.7.3) mangles with no Safari errors.

binomialstew commented 8 years ago

I just updated to CodeKit 3.0.3 and can confirm that this is still an issue.

bdkjones commented 8 years ago

Mmm... 3.0.3 has Uglify 2.7.3. If there's still a problem, please provide an exact example and files to reproduce. Those will likely need to go to the Uglify team.

binomialstew commented 8 years ago

Yes, you are right. My apologies. The error I am seeing now has to do with a prepended library that is misusing "delete".

What threw me off is when I mangle and compress using uglify via terminal, "strict mode" is not prepended to my output file, but when using CodeKit's uglify, it is. Do you know why this would be?