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

invalid generated js for `(a ?? {}) && ""`

Open Le0Developer opened this issue 2 years ago • 1 comments

Describe the bug:

Compiles invalid JS

Config and Small code sample

Config:

{
  target: "node",
  preset: "high"
}

Code:

(a ?? {}) && ""

Expected behavior

Compiles to (a??{})&&''

Actual behavior

Compiles to a??{}&&'' which is invalid.

Le0Developer avatar Jan 17 '23 22:01 Le0Developer

I believe this error has to do with escodegen or acorn, not with the obfuscator itself. I don't know how to fix this.

MichaelXF avatar May 16 '23 00:05 MichaelXF

Fixed in 2.0 (Currently 2.0.0-alpha.2). The 2.0 version nows uses Babel's parser and generator and is more suited for modern JavaScript syntax.

MichaelXF avatar Sep 30 '24 15:09 MichaelXF