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

Error: SyntaxError: Unexpected token operator «*», #1199

Closed
mkastner opened this issue Jul 10, 2016 · 13 comments
Closed

Error: SyntaxError: Unexpected token operator «*», #1199

mkastner opened this issue Jul 10, 2016 · 13 comments

Comments

@mkastner
Copy link

Hi,
it seems like I can't get my code compressed due to generator functions. I don't know, why. Should I rather use the harmony branch for ES6 functionality?

Build error
Error: SyntaxError: Unexpected token operator «*», expected punc «(» (line: 17534, col: 40, pos: 578197)

Error
    at new JS_Parse_Error (eval at <anonymous> (/path/to/app/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1545:18)
    at js_error (eval at <anonymous> (/path/to/app/node_modules/uglify-js/tools/node.js:28:1), <anonymous>:1553:11)
@avdg
Copy link
Contributor

avdg commented Jul 10, 2016

There is no complete support for import statements yet in uglifyjs on harmony until there are patches to implement it properly.

@rvanvelzen
Copy link
Collaborator

ES6 features are only available on the harmony branch. #448 is for harmony support.

@mkastner
Copy link
Author

@avdg I understand that there is no support for import statements. And I am not using them anyway. It's all cjs. The build error isn't caused by an import statement. It's caused by a generator function.

@rvanvelzen I got it, thanks.

@avdg
Copy link
Contributor

avdg commented Jul 17, 2016

@mkastner Feel free to submit a test case

@mkastner
Copy link
Author

@avdg I apologize for not being able to submit a test case. However the error can also be reproduced here:

http://lisperator.net/uglifyjs/#demo

by entering:

function*() {   
    yield [];
}

It comes up with:

Parse Error:
Unexpected token: operator(*)

@avdg
Copy link
Contributor

avdg commented Jul 18, 2016

Uh... I won't test harmony on that site... I would rather checkout the harmony branch. The code on lisperator doesn't even match v2.7.0 code when I checked lastly.

@bajacondor
Copy link

Did you get anywhere on this? I'm seeing the same thing. Is there a way to exclude a file from uglify?

@avdg
Copy link
Contributor

avdg commented Aug 31, 2016

unnamed function and not assigned. Fixing either one should fix it.

@avdg
Copy link
Contributor

avdg commented Aug 31, 2016

Also, drop the code in the console in a browser, I don't think your example was valid anyway.

@avdg
Copy link
Contributor

avdg commented Aug 31, 2016

Normally all files should be inputted 1 by 1, but linux seems to support expansion before uglify notices it. The solution would be to not make that file list in that pattern (or keep it out of the list if it's not listed by the pattern), but I'm not sure if that will work for you.

@mkastner
Copy link
Author

mkastner commented Sep 1, 2016

@avdg
I apologize for the late reply. I am currently on the road and not able to check. But I will ASAP.

@avdg
Copy link
Contributor

avdg commented Sep 1, 2016

No worries

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

4 participants