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

Uglifier complains about field declaration syntax #176

Open
toomanyjoes opened this issue Jul 24, 2020 · 1 comment
Open

Uglifier complains about field declaration syntax #176

toomanyjoes opened this issue Jul 24, 2020 · 1 comment

Comments

@toomanyjoes
Copy link

toomanyjoes commented Jul 24, 2020

I'm am using the harmony option in my Rails configuration and the latest version of the gem as of this time (4.2.0):

config.assets.js_compressor = Uglifier.new(harmony: true)

But when I try to use field declaration syntax inside a js class uglifier complains:

Uglifier::Error: Unexpected token: punc (;)

or

Uglifier::Error: Unexpected token: operator (=)

My javascript class looks like this as shown here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes:

class Rectangle {
  width;
  height = 0;
  constructor(height, width) {    
    this.height = height;
    this.width = width;
  }
}

Is there a way to fix this? And if not is there a way to disable uglifier for specific lines or an entire file?

@toomanyjoes toomanyjoes changed the title U Uglifier complains about field declaration syntax Jul 24, 2020
@ahorek
Copy link

ahorek commented Dec 8, 2020

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