HookyQR / VSCodeMinify

Add minify function to VSCode 0.10+
53 stars 21 forks source link

JS optional chaining operator (?.) #63

Closed bgoewert closed 3 years ago

bgoewert commented 3 years ago

I'm having an issue with the optional chaining operator (?.) for JavaScript. I get an error saying "Unexpected token: punc(.)"

Example:

let header = document.querySelector('.header'),
        cover = document.querySelector('.cover'),
        wpadminbar = document.querySelector('#wpadminbar');
cover.querySelector('.wp-block-cover').style.minHeight = (window.innerHeight - header.offsetHeight - (wpadminbar?.offsetHeight || 0)) + 'px';

Attempting to minify this will fail with the "Unexpected token: punc(.)" error.

I thought it might have been related to #27. But that ticket seems to have been resolved, even though it's not closed and was submitted 3 years ago. Is this project maintained anymore?

bgoewert commented 3 years ago

UglifyJS has supported this new optional chaining operator since v3.13.6. It looks like the minify package is on v3.4.10? https://github.com/mishoo/UglifyJS/releases/tag/v3.13.6

bgoewert commented 3 years ago

Didn't see this was already reported here. #62