Closed Sorte1 closed 6 months ago
a possible but not ideal fix would just be moving the variable assignment down
let adad = 1
function func(arg1, arg2 = 0, arg3 , arg4 = 30) {
arg3 = adad
return arg1;
}
Yeah that's a known issue: https://github.com/babel/minify/issues/1023 It doesn't seem to be maintained anymore and isn't really the right tool (as it optimizes for 1 letter names and gzip compression rather than readability)
Your suggested fix could work with some changes so I'll try applying it for now, but the name mangling will eventually be redesigned from scratch: #21
let adad = 1
// dummy default param to retain arguments.length and func.length == 1 behaviour
function func(arg1, arg2 = 0, arg3 = undefined , arg4 = 30) {
if (arg3 === undefined) arg3 = adad; // only set when the arg isn't passed
return arg1;
}
Could you check if everything works now? https://deploy-preview-42--webcrack.netlify.app/
works fine for me
I just tried it again, and now it works...
oops had a bug in it, !==
should be ===
when i looked at it, i was like thats not gonna work, but then i got distracted and forgot to write the comment
when will this fix be released?
I released it now
Describe the bug
When passing an identifier as a default parameter valuee, i doest work
the error seems to come from "babel-plugin-minify-mangle-names/lib/scope-tracker.js" line 47
Expected Behaviour
Code