Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue When Transpiling / Minifying #78

Closed
snuggs opened this issue Jul 2, 2017 · 5 comments
Closed

Issue When Transpiling / Minifying #78

snuggs opened this issue Jul 2, 2017 · 5 comments

Comments

@snuggs
Copy link
Member

snuggs commented Jul 2, 2017

I think there is an issue with Uglify-JS or webcomponentsjs. As it's breaking our functionality in Safari at least within jsfiddle. https://jsfiddle.net/whdLtc5q/

capture d ecran 2017-07-02 a 01 15 07

@snuggs
Copy link
Member Author

snuggs commented Aug 2, 2017

This only comes up when using minified es6. @pachonk care to test this out?

@grepsedawk
Copy link
Collaborator

grepsedawk commented Aug 2, 2017 via email

@snuggs
Copy link
Member Author

snuggs commented Aug 2, 2017

@pachonk check out the dist readme. It's in the minification step. Converting es6 to es5. I think our polyfill uses the same minifier thus creating the same tiny variable names e.

We use this https://github.com/paulovieira/UglifyJS2

@snuggs
Copy link
Member Author

snuggs commented Aug 2, 2017

@pachonk to be clear i don't know what that first error is. That should cure half your queries. 😜

@snuggs
Copy link
Member Author

snuggs commented Aug 22, 2017

@angelocordon @robcole @brandondees come to find out this was a bug in Safari. They have recently fixed it and is in current preview of Safari 11 (releasing in September). This is a good thing but requires someone to be forced to update. This bug still lingers for many people on safari who haven't updated. This is a perfect example of by leaning on the specs since they are "living" not every browser will always be at 100%. That being said the onus is on the PLATFORM VENDOR not the developer to update as in this case. The problem is happening when we minify ES6 -> ES6(minified with UglifyJS). I'll get this fixed up after I do a little research on the references. Luckily we have an unminified version that works fine and can use that in the mean time for Safari support. Thus (temporarily) fixing the initial issue @angelocordon and I first discovered.

Reference Links

Fix for UglifyJS

safari10: true
https://github.com/mishoo/UglifyJS2/tree/harmony#mangle-options

Problematic UglifyJS Output

If you notice below the .assign (e, ...) is being shadowed by let e later within the function. The ECMAScript language has no issue with shadowing variables (We do this with Element vs window.Element)
capture d ecran 2017-08-22 a 09 58 00
capture d ecran 2017-08-22 a 09 57 26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants