ckeditor / ckbuilder

The development repository of CKBuilder, a command line builder for CKEditor 4.
Other
19 stars 11 forks source link

Uknown option `--language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT` #25

Open rjcorwin opened 6 years ago

rjcorwin commented 6 years ago

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?

wwalc commented 6 years ago

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.

rjcorwin commented 6 years ago

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

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

rjcorwin commented 6 years ago

Thanks @wwalc !

wwalc commented 6 years ago

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: