You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(function() {
function t() {
function t() {
console.log({
v1: n
})
}
if (1) {
n();
function n() {}
}
t()
}
var n = !0;
t()
}
)()
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.
The text was updated successfully, but these errors were encountered:
(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.
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.
The text was updated successfully, but these errors were encountered: