-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
IE8 flag + mangle w/ locals with the same name as functions is causing hoisting issues in IE8 #3355
Comments
Your example won't work under IE8
|
I was not clear in the example since I typed it from memory but it seems you have figure out the issue from above, right? :) It's the shadowing from the JScript engine that is causing the problems. |
I found one issue which I've made a Pull Request to fix, but I'm not sure if that's your actual issue though. It would be helpful if you can confirm the changes in #3356 works for your actual codebase. |
Just checked and it didn't seem to. To be clear, all I did was clone the repo, apply the patch from their PR and then replace the folder in my The issue I am observing boils down to the following:
The issue is that I've worked around this for now by just renaming the locally scoped variables inside of the methods to something other than what the identifier of the method name is. Once you do that, things minify fine and there is no problem. Is there anything else I can do for you? I can try and par it down into something more runnable as well but since it's an enterprise application, I'll probably need to see if if I can create a stripped down example in a repo somewhere... since I can't just link the entire code base. |
What I'm saying is that your original, unmangled example doesn't work in IE8, and for the same reason as well. So what I need is an example that:
Take the new test cases in #3356, before the fix the mangled output would have been |
OK, I setup an example repo for you here. https://github.com/hilts-vaughan/uglifyjs-ie8-bug-demonstration I did the following..
I am using IE11 compat. mode here for the better debugger -- but the result is the same, compatibility or not. For the record, it works fine in version Do you need more info than this or is this enough for you to go on? |
Please be advised you can find the broken output here: https://github.com/hilts-vaughan/uglifyjs-ie8-bug-demonstration/blob/master/app.min.js You can find the output of 2.6.4 here: https://github.com/hilts-vaughan/uglifyjs-ie8-bug-demonstration/blob/master/app.old.min.js You can note the differences are mostly in the variable name(s) assigned to the method in If you have questions, let me know.. |
Thanks a lot for the hard work! I'll have a look this weekend and track down the root cause. |
Great, thank you! Let me know if you need any more info. |
Turns out the Pull Request already fix your test case as well − in any case, we now have a new test case 😉 |
Interesting! I tried applying the patch to the entire code base before and couldn't get it to work -- but it was using Could you publish a new version to NPM and I will test? :) |
Sure, will do. |
I can confirm w/ the latest version that my project is building and passing testing under IE again. Thank you for your hard work! |
Thank you for the helpful details and testing confirmation 😉 |
Bug report or feature request?
Given the following snippet:
Uglify version (
uglifyjs -V
)3.5.2
JavaScript input
^ with the above input
JavaScript output or error produced.
You will note the named function has the same name as the local. This causes issues and mixes up what
this
is in the context of the function since JScript bugs 😱http://kangax.github.io/nfe/#jscript-bugs
The text was updated successfully, but these errors were encountered: