js-confuser icon indicating copy to clipboard operation
js-confuser copied to clipboard

Minify not support destructuring assignment

Open youdie323323 opened this issue 1 year ago • 0 comments

Describe the bug:

Cant minify code with minify

Config and Small code sample

Config:

{
    target: "browser",
    minify: true,
}

Code:

let objectSlice = [];
objectSlice.push({
    a: 1,
    b: 2,
    c: 2,
})
objectSlice.push({
    a: 2,
    b: 3,
    c: 4,
})
for (let {
    a,
    b,
    c
} of objectSlice) {
    console.log(a);
    console.log(b);
    console.log(c);
}

Expected behavior

Minify should minify code without error and output codes

Actual behavior

\src\dist\transforms\minify.js:427
      if (object.id.type == "ObjectPattern" && object.init.type == "ObjectExpression") {
                                                           ^
TypeError: Cannot read properties of null (reading 'type')

got this error from minify

youdie323323 avatar Mar 21 '24 20:03 youdie323323