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::Error: #173

Open
cs0511 opened this issue Mar 26, 2020 · 6 comments
Open

Uglifier::Error: #173

cs0511 opened this issue Mar 26, 2020 · 6 comments

Comments

@cs0511
Copy link

cs0511 commented Mar 26, 2020

Uglifier::Error:
from ****gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result'

To reproduce the error, just paste the code in your file and run Uglifier.new(harmony: true).compile(File.read("test.js"))

function f(){ return 1;};
var y = 42;

y = f();

const {p} = {p: 42};

But these code won't raise this error:

function f(){ return 1;};
var y = 42;

y = f();
console.log(123)
const {p} = {p: 42};
function f(){ return 1;};
var y = 42;
const {p} = {p: 42};
y = f();

Any one knows the reason? I am using uglifier (4.2.0)

@timminkov
Copy link

Getting the same error. Had to fork the gem, re-package the harmony branch of uglify, then copy it into the fork. Seems to be working now - not sure what the cause is.

@longpaid
Copy link

Getting the same error. Had to fork the gem, re-package the harmony branch of uglify, then copy it into the fork. Seems to be working now - not sure what the cause is.

had the same same issue, had to reference your version and it worked for me too, thank you 👍

@netelix
Copy link

netelix commented May 28, 2021

Same issue...
I went back to Uglifier 4.1.0 in my Gemfile and it fixed it. Thanks for the tip

gem 'uglifier', '= 4.1.0'

@bsodmike
Copy link

bsodmike commented Jun 9, 2021

Same issue...
I went back to Uglifier 4.1.0 in my Gemfile and it fixed it. Thanks for the tip

gem 'uglifier', '= 4.1.0'

Thanks so much. We spent two days tracing this down. 👀

@syntruth
Copy link

syntruth commented Jun 15, 2021

It's the de-structured assignment, somehow.

4.2.0 breaks on my code as well, on this line:

var [icon, title, typeClass] = this.__typeData(type)

If I use a traditional way of de-structuring my data -- or just comment out that line -- it uglifies just fine.

Thanks for the 4.1.0 tip; it saved me some headaches on the upcoming production push. :)

@rgaufman
Copy link

After trying to get this working with Uglifier, I ended up switching to Terser, more details here: #185

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

7 participants