Open seth-drf opened 2 months ago
(function(){ var v1 = true; function someFunction() { if (true) { useMyFunction(); // Renamed to avoid collision function useMyFunction() { // Renamed to avoid collision } } function displayFunction() { // Renamed to avoid collision console.log({v1}); } displayFunction(); } someFunction(); })();
Changes ensure that function names are unique and do not conflict with other variable or function names, which could lead to issues in minification or during execution.
(function(){ var v1 = true; function someFunction() { if (true) { useMyFunction(); // Renamed to avoid collision function useMyFunction() { // Renamed to avoid collision } } function displayFunction() { // Renamed to avoid collision console.log({v1}); } displayFunction(); } someFunction(); })();
Changes ensure that function names are unique and do not conflict with other variable or function names, which could lead to issues in minification or during execution.
Pretty sure this wont help at all
I'm using version 1.21.9.
Describe the bug NUglify is giving a function inside a block the same name as a variable in a closure.
To Reproduce How I'm running it:
JavaScript inside js variable:
Minified output Before formatting:
After formatting:
Excepted output code The v1 variable and the myFunction function should have different names.
Running the original JavaScript puts an object with v1 set to true into the console. Running the minified JavaScript puts an object with v1 set to the function.