Open jfrank14 opened 1 year ago
array destructuring is a relatively new syntax, NUglify probably doesnt support it at all, hence the mad output. PRs welcome
Is that because uglify-js itself doesn't support it, or is this specific to NUglify?
Curiously, it seems to work fine to destructure arrays as long as no default values are specified.
I'm a bit swamped with work, but will try to find a bit of time to see if I could fix this.
https://github.com/trullock/NUglify/blob/master/src/NUglify.Tests/JavaScript/ES2015.cs#L100
This test already exists, look when it was added and what was touched as a starting point.
Otherwise add breakpoints inside JSParser
, maybe in ParseArrayLiteral
My source code is this:
but NUglify is rewriting this as:
Variables
c
andu
are then intended to bename
andemail
, but are always undefined.Also, that
if
syntax followed by a comma looks really suspect too.However, if I change it to remove the default values, it produces working and reasonable code: