-
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
Writing self-executing functions with !function(){}() is sometimes unsafe #625
Comments
There is a flag, try passing |
That is not the right answer. You are looking to preserve the program completion value. See #543 for the previous discussion about this. |
I propose the following fix: |
Track #640 for follow-up. |
alexlamsl
added a commit
to alexlamsl/UglifyJS
that referenced
this issue
Mar 1, 2017
Things like Angular Expression and Bookmarklet do not specify `return`, but implicitedly assumes the evaluated value from the final statement to be the return value. fixes mishoo#354 fixes mishoo#543 fixes mishoo#625 fixes mishoo#628 fixes mishoo#640 closes mishoo#1293
alexlamsl
added a commit
to alexlamsl/UglifyJS
that referenced
this issue
Mar 2, 2017
Bookmarklet for instance implicitedly assumes a "completion value" without using `return`. The `expression` option now supports such use cases. Optimisations on IIFEs also enhanced. fixes mishoo#354 fixes mishoo#543 fixes mishoo#625 fixes mishoo#628 fixes mishoo#640 closes mishoo#1293
alexlamsl
added a commit
to alexlamsl/UglifyJS
that referenced
this issue
Mar 3, 2017
Bookmarklet for instance implicitedly assumes a "completion value" without using `return`. The `expression` option now supports such use cases. Optimisations on IIFEs also enhanced. fixes mishoo#354 fixes mishoo#543 fixes mishoo#625 fixes mishoo#628 fixes mishoo#640 closes mishoo#1293
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the example:
versus
A
andB
cause the same side effects, but the result of each expression is different,5
inA
andfalse
inB
I am uglifying code files that look something like
A
, which are rewritten toB
, and I am running into this issue because the minified files are passed to a processor that uses the result ofeval()
on the minified code.I did not find a flag to uglify that controls this behavior, but I was curious whether:
The text was updated successfully, but these errors were encountered: