-
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
2.8.8 can break recursive function calls #1575
Comments
Original example was a bit too simple, updated to reflect real minimal example |
Temporary 2.8.8 workaround - use
module.exports = function() {
!function myFunction() {
myFunction();
}();
}; |
Duplicate: #1573 |
@alexlamsl This appears to fix it: --- a/lib/compress.js
+++ b/lib/compress.js
@@ -2611,9 +2611,6 @@ merge(Compressor.prototype, {
if (compressor.option("unused")
&& def.references.length == 1
&& compressor.find_parent(AST_Scope) === def.scope) {
- if (!compressor.option("keep_fnames")) {
- exp.name = null;
- }
self.expression = exp;
}
} |
alexlamsl
added a commit
to alexlamsl/UglifyJS
that referenced
this issue
Mar 8, 2017
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out. fixes mishoo#1573 fixes mishoo#1575
alexlamsl
added a commit
that referenced
this issue
Mar 8, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When minifying the following function
with the following incantation
./node_modules/.bin/uglifyjs --compress '' file.js -o minified.js
Then the following warning will be emitted:
WARN: Dropping unused variable myFunction
This is not correct, because the variable is used inside the recursive call. Furthermore, this will generate invalid code that references
myFunction
inside the function call and you will get an undefined variable error at runtimeWe've confirmed that this broke in the most recent build (2.8.8)
The text was updated successfully, but these errors were encountered: