circlecell/jscompress.com

Compressor does not understand classes

Opened this issue · 1 comments

When I try to compress a script with a class on the site (https://jscompress.com), it gives me an error. Take this simple example:

class MyClass {
    constructor(item) {
        this.item = item
    }

    thing() {
        alert(this.item)
    }
}

new MyClass()

It gives me this an error:
Unexpected token: name «MyClass», expected: punc «;» (line: 1, col: 6)

I would really like class compression, as it is supported in a lot of browsers:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

enable ECMAScript 2021 (via babel-minify) and it will minify