10-11-2019 05:52 PM
Hi,
I'm using some JS component in AIKAU widgets. It works fine when debug mode is enabled in share, but when debug is disabled, widget is not rendered.
Following error message appears in log: [extensions.surf.ClosureJavaScriptCompressionHandler] [http-apr-8080-exec-7] input.js:195: ERROR - this language feature is only supported for ECMASCRIPT6 mode or better: class. Use --language_in=ECMASCRIPT6 or ECMASCRIPT6_STRICT to enable ES6 features.
I'm using alfresco CE 5.2.g with aikau 1.0.101.
How to enable ES6 support on ClosureJavaScriptCompressionHandler ?
Thanks.
10-12-2019 12:06 PM
Instead of trying to fiddle with the ClosureJavaScriptCompressionHandler, you may be better off to replace that with the ExternalJavaScriptCompressionHandler, which is able to call an external command (most likely some Node.js based script) to run the compression. This class was introduced alongside ExternalLessCssThemeHandler to allow for flexibility in using better tools, when the Surf-provided classes did not keep up with current standards - which they have not, considered there isn't any noticeable development anymore apart from bugfixes.
10-12-2019 01:04 PM
Thanks for this valuable advice.
Could you share an example of how to implement this ?
(the error message of ClosureJavaScriptCompressionHandler looks like a simple settings may enable ES6 support. What do you think about that ?)
10-14-2019 04:18 PM
You'll need to configure a bean with ID "javascript.compression.handler" using that class, e.g. in custom-slingshot-application-context.xml, and have that bean extend from the parent "javascript.compression.handler.abstract".
Sure, the error message sounds like you could just set a flag. But the flag is currentl hard-coded in the ClosureJavaScriptCompressionHandler class and would require you to patch that class and recompile.
Explore our Alfresco products with the links below. Use labels to filter content by product module.