-
Notifications
You must be signed in to change notification settings - Fork 662
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
YUI Compressor 2.4.8 failed on jQuery 2.2 #234
Comments
same problem here! |
Any chance that this will be fixed? |
This is a bug in YUI Compressor. Could you report it to them? |
It is reported to the YUI Compressor, isn't it? |
I'm sorry, for a moment I thought it was reported against jQuery... I commented too fast, please disregard. |
Problem: "throws" and several other names are marked as reserved in YUI, while jquery assumes they are not and uses them. Step1: Make a list of all wrongly-reserved-names plus proof-link If there is already such PR, link it here. Haven't found one. |
To clarify - "throws" and several other names are marked as reserved in JAVASCRIPT, and YUICompressor is respecting that declaration. The trick that makes it a bit harder is that YUICompressor isn't tied to a specific version of Java/ECMAScript, and in older versions, these are illegal identifiers. So you have to allow it for ES5+ while not allowing it in ES4 and earlier; while keeping in mind that there's no standardized way for a bit of JavaScript code to declare which version of JS/ES it thinks it wants to be. If you have ideas for solving all of those problems in the same go, I'd love to hear about them! :) |
As an ugly workaround it could be possible to do a replacement before / after minification. The replacement-logic could be triggered by a simple --language-version parameter. |
Same issue with To reproduce download kotlin-compiler-1.0.1.zip and see |
Well, any chance this to be fixed? |
+1 |
I have this same issue with pdf.js, I tried to give them a pull request and they rejected it, pointing out that 'char' is not a reserved word in ES5.1 and that ECMSScript permits reserved words ('catch', 'delete') as property names. So, declaring a reserved word variable or function is illegal but assigning a function literal to a reserved word property is valid. |
I think this is related to the keywords that js file uses clash with some in-build keywords of the compressor. you can try using the minified version of the js file to get rid of this issue. this is something i did in my project when using jquery-3.1.0. |
A work around by using babel plugins: |
Still breaking for jquery is there a reason this is closed? |
@nueverest This issue is not closed. |
+1 |
1 similar comment
+1 |
Issue still appears. As you can see it here too: #262 Is this Project still alive? |
+1 |
Yuicompressor fails against jquery v3.3.1 too
|
That's correct - jquery 3.3.1 is not valid ECMAScript 3 syntax; YUICompressor does not support anything else at this time. |
I have solved with custom methods, i have used a fork https://github.com/MrD0llaro/yuicompressor |
When I try to pass original uncompressed jquery-2.2.0.js file to YUI Compressor 2.4.8 I get following output (with jquery-2.1.4.js it works):
The text was updated successfully, but these errors were encountered: