Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressor does not understand classes #78

Open
plasma4 opened this issue Dec 19, 2021 · 1 comment
Open

Compressor does not understand classes #78

plasma4 opened this issue Dec 19, 2021 · 1 comment

Comments

@plasma4
Copy link

plasma4 commented Dec 19, 2021

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

@BackuPs
Copy link

BackuPs commented Dec 20, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants