ckbuilder icon indicating copy to clipboard operation
ckbuilder copied to clipboard

Uknown option `--language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT`

Open rjcorwin opened this issue 7 years ago • 4 comments

I'm getting the following error when building.

Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT to enable ES6 features

Adding this suggested option to ./build.sh results in crashing as well. Am I missing something?

rjcorwin avatar Jul 23 '18 00:07 rjcorwin

Unfortunately CKBuilder does not support ES6 syntax and this flag. The error comes from Closure Compiler, which is used internally by CKBuilder.

It means that even if you want to use such a simple thing such as let or const instead of var, CKBuilder will not let you do this and will fail throwing this error about unsupported ES6 syntax.

I tried to update Closure Compiler in CKBuilder and add support for ES6, ~but unfortunately the first attempt ended up with strange errors (Cannot convert UTF-8 to java.nio.charset.Charset just to name the first issue)~. Update: the builder kinda works, but does not pass all tests.

As a workaround, at least for the time being, you need to translate the plugin to ES5 and then run CKBuilder with it.

wwalc avatar Jul 30 '18 13:07 wwalc

you need to translate the plugin to ES5 and then run CKBuilder with it.

Gotcha, we could babel it first, then run CKBuilder.

rjcorwin avatar Jul 30 '18 19:07 rjcorwin

Thanks @wwalc !

rjcorwin avatar Jul 30 '18 19:07 rjcorwin

Short update: it looks like I have to give up for now with adding the ES6 support. I pushed my changes to the es6 branch (no es6 support yet, just updated closure compiler). After I updated the closure compiler to version 20180716 it started complaining about many issues that it did not complain about before, for example:

This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.

when using CS with ES5 mode (which we should continue using for the online builder) (com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT5).

Unfortunately failing on errors like this would be a major problem for the online builder, because many 3rd party plugins include such code.

While I completely agree that such code should be cleaned up, the reality is that it would take months for 3rd party maintainers to correct their plugins and some of them would have to be fixed by us, because we may expect that some plugins are also no longer actively maintained.

So in other words, this grows to quite a time consuming task:

  • Verify and adjust ckbuilder so that the new closure compiler will be able to create a working build with every single addon that has been already added to the addons repository (if doable at all).
  • Add more errors to the list of ignored issues: https://github.com/ckeditor/ckbuilder/blob/es6/src/lib/javascript.js#L112

wwalc avatar Jul 31 '18 11:07 wwalc