VSCodeMinify icon indicating copy to clipboard operation
VSCodeMinify copied to clipboard

Nullish Colaescing Operator ?? causes an error

Open xavi-mat opened this issue 2 years ago • 2 comments

It seems that Minify can't manage the nullish coalescing operator. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

I'm trying to minimize this:

const a = document.nonExistent ?? "Not found";

And get:

Minify failed: Unexpected token: operator (?)

Am I missing something?

xavi-mat avatar Sep 14 '22 10:09 xavi-mat

Can confirm this also happens with something?.something syntax. The ? causes the next token to be unexpected

flan6 avatar Aug 16 '24 19:08 flan6

Yes, It also can be confirmed that optional chaining ?. causes an "unexpected punc(.)" error.

lyc0930 avatar Aug 21 '24 08:08 lyc0930