Skip to content

2.8.8 can break recursive function calls #1575

Description

@pfhayes

When minifying the following function

module.exports = function outer() {
  var myFunction = function myFunction() {                                                                       
      myFunction();
  };
  myFunction();
};

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 runtime

We've confirmed that this broke in the most recent build (2.8.8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions