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

Doesn't Support JavaScript (ES6/ES2015)? #262

Open
jinliming2 opened this issue Dec 11, 2016 · 25 comments
Open

Doesn't Support JavaScript (ES6/ES2015)? #262

jinliming2 opened this issue Dec 11, 2016 · 25 comments

Comments

@jinliming2
Copy link

jinliming2 commented Dec 11, 2016

Code

(() => {
    console.log(123);
})();

Command

"C:\Program Files\Java\jdk1.8.0_112\jre/bin/java" -jar F:/库/JetBrain/yuicompressor-2.4.9.jar common.js -o common.min.js

Error

[ERROR] in common.js
  21:3:syntax error
[ERROR] in common.js
  22:13:syntax error
[ERROR] in common.js
  23:1:syntax error
[ERROR] in common.js
  1:0:Compilation produced 3 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 3 syntax errors.
	at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:193)
	at org.mozilla.javascript.Parser.parse(Parser.java:396)
	at org.mozilla.javascript.Parser.parse(Parser.java:340)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:315)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:540)
	at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:168)
	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)

Process finished with exit code 2
@LeiZeng
Copy link

LeiZeng commented Dec 27, 2016

@Chris2011
Copy link

As you can see it here: https://github.com/Chris2011/js-css-minify-compress the yui-compressor.jar is using as a wrapped lib for a plugin for NetBeans to compress JS files for example. It gives me thos output:

org.mozilla.javascript.EvaluatorException: Compilation produced 14 syntax errors.
	at org.netbeans.util.source.minify.MinifyUtil$CompressorErrorReporter.runtimeError(MinifyUtil.java:485)
	at org.mozilla.javascript.Parser.parse(Parser.java:396)
	at org.mozilla.javascript.Parser.parse(Parser.java:340)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:315)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:536)
	at org.netbeans.util.source.minify.MinifyUtil.compress(MinifyUtil.java:371)
	at org.netbeans.util.source.minify.JSMinify.jsMinify(JSMinify.java:99)
	at org.netbeans.util.source.minify.JSMinify.access$000(JSMinify.java:47)
	at org.netbeans.util.source.minify.JSMinify$1.run(JSMinify.java:65)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

when I try to minify this file: http://honlapgyartok.hu/sandbox/FrameworkShared/js/Webbi/Plugin/FormBuilder.js

@Chris2011
Copy link

Chris2011 commented Mar 7, 2017

It happens here:

$(e).on('click', function(
   var id = SELF._getFormId(ev.target);
   SELF.export(id);
});

I reduced it to:

var SELF = this;
var id = 1;

SELF.export(id);

So the problem is export, which yuicompressor can't handle. Because of a keyword of ES6?

@Chris2011
Copy link

Anything new here? Please add ES6 support.

@Chris2011
Copy link

Progress?

@valentinbdv
Copy link

+1 would be great to have ES6 support!

@zetekla
Copy link

zetekla commented Sep 16, 2017

add support for Webpack, Browserify and better yet ES6 altogether pls.

@sjtower
Copy link

sjtower commented Oct 18, 2017

We'll be dropping YUI unless it can support ES6 soon

@mirbaagheri
Copy link

mirbaagheri commented Oct 20, 2017

Does not support for ECMA6?

[ERROR] in DataTables.js
  1:6:identifier is a reserved word
[ERROR] in DataTables.js
  4:31:syntax error
[ERROR] in DataTables.js
  139:42:missing ) after formal parameters
[ERROR] in DataTables.js
  139:42:missing } after function body
[ERROR] in DataTables.js
  148:47:syntax error
[ERROR] in DataTables.js
  171:13:syntax error
[ERROR] in DataTables.js
  173:30:missing ; before statement
[ERROR] in DataTables.js
  175:56:missing ; before statement
[ERROR] in DataTables.js
  177:25:syntax error
[ERROR] in DataTables.js
  206:17:syntax error
[ERROR] in DataTables.js
  226:13:syntax error
[ERROR] in DataTables.js
  228:19:syntax error
[ERROR] in DataTables.js
  230:19:syntax error
[ERROR] in DataTables.js
  239:13:syntax error
[ERROR] in DataTables.js
  356:9:syntax error
[ERROR] in DataTables.js
  358:15:invalid return
[ERROR] in DataTables.js
  363:14:syntax error
[ERROR] in DataTables.js
  365:22:syntax error
[ERROR] in DataTables.js
  366:26:syntax error
[ERROR] in DataTables.js
  367:14:syntax error
[ERROR] in DataTables.js
  368:22:syntax error
[ERROR] in DataTables.js
  370:13:syntax error
[ERROR] in DataTables.js
  371:30:syntax error
[ERROR] in DataTables.js
  373:25:syntax error
[ERROR] in DataTables.js
  389:13:syntax error
[ERROR] in DataTables.js
  392:5:syntax error
[ERROR] in DataTables.js
  393:1:syntax error
[ERROR] in DataTables.js
  395:9:syntax error
[ERROR] in DataTables.js
  1:0:Compilation produced 28 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 28 syntax errors.
	at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:172)
	at org.mozilla.javascript.Parser.parse(Parser.java:396)
	at org.mozilla.javascript.Parser.parse(Parser.java:340)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:315)
	at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:536)
	at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:147)
	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)

Process finished with exit code 2

@jinliming2
Copy link
Author

Is this project still alive?

@Chris2011
Copy link

@jinliming2 As you can see, they merged some PRs some days/weeks ago. But no real effort on this project anymore(?). @tml can you explain the state here? Waiting for smth or change smth or what? Can you clarify that please?

@yoshicode
Copy link

+1

@jkeam
Copy link

jkeam commented May 11, 2018

Proj is dead?

@kcak11
Copy link

kcak11 commented Jun 8, 2018

Looks like project is dead long back. RIP yuicompressor

@iileandro
Copy link

+1!

@iileandro
Copy link

iileandro commented Mar 27, 2019

Guys, someone here found an alternative (jar lib) to yuicompressor with ES6 support?

@kcak11
Copy link

kcak11 commented Mar 28, 2019

Guys, someone here found an alternative (jar lib) to yuicompressor with ES6 support?

As far as I have researched, I believe yuicompressor is a pretty old library which is not being maintained anymore and hence it does not cater to ES6 and the newer syntaxes.

If you are really looking for JS compression, then probably you will have to look for alternative bundling approaches like webpack, javascript-minifier, jscompress, etc.,.

@iileandro
Copy link

iileandro commented Mar 28, 2019

Yep. I got terser (npm based). It saved me. The only one I've tested that was able to ES6 at all! I call the command from java stead of YUICompressor lib call.

@kcak11
Copy link

kcak11 commented Mar 28, 2019

I believe you meant terser

@iileandro
Copy link

yep. Sorry!

@zetekla
Copy link

zetekla commented Mar 30, 2019 via email

@zetekla
Copy link

zetekla commented Mar 30, 2019 via email

@DougBaughman
Copy link

Is there a maven plugin for Google Closure Compiler? LIke yuicompressor-maven-plugin

@Chris2011
Copy link

Chris2011 commented Apr 7, 2021

Is there a maven plugin for Google Closure Compiler? LIke yuicompressor-maven-plugin

https://mvnrepository.com/artifact/com.google.javascript/closure-compiler @DougBaughman ;)

@DougBaughman
Copy link

DougBaughman commented Apr 7, 2021

Thanks @Chris2011, but I'm looking for a Maven plug-in (mojo), not just a dependency. I want something that will minify javascript automatically as part of a maven build. LIke http://davidb.github.io/yuicompressor-maven-plugin/ does with yuicompressor

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