openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
765 stars 374 forks source link

Minification with yui fails #1281

Open Gama11 opened 5 years ago

Gama11 commented 5 years ago

Even in an empty project, -minify -yui doesn't work anymore (I'm assuming at some point it did):

>lime create project LimeProject

>cd LimeProject

>lime build html5 -minify -yui

[ERROR] 1288:9:missing variable name

[ERROR] 1289:8:identifier is a reserved word

[ERROR] 1290:28:identifier is a reserved word

[ERROR] 1291:8:missing ; before statement

[ERROR] 1292:13:identifier is a reserved word

[ERROR] 1294:1:missing ) in parenthetical

[ERROR] 20088:1:syntax error

[ERROR] 1:0:Compilation produced 7 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 7 syntax errors.
        at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:154)
        at org.mozilla.javascript.Parser.parse(Parser.java:392)
        at org.mozilla.javascript.Parser.parse(Parser.java:337)
        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
        at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533)
        at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:131)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

(I was just checking to see if yui is perhaps a bit faster, since Closure seems to be quite slow)

jgranick commented 5 years ago

Perhaps we should look at using UglifyJS, as I've found that to be reliable, and much faster than Closure.

I really like the idea of making our HTML5 target use NPM, either optionally or by default, but I just cannot decide how to handle npm install, as we would not want to run that very often at all. Perhaps only if the node_modules directory is not present? We could talk about this on chat as well.

If Haxe output is not compatible with YUI, we probably should deprecate the option (and make it use closure anyway)