Expand my Community achievements bar.

SOLVED

Disable ES6 to ES5 Clientlib Preprocessor?

Avatar

Level 1

Hello.

 

After updating from AEM 6.5.11 to AEM 6.5.17, some of our Clientlibs for dialogue extensions are no longer working. The cause appears to be that we have ES6 code, which has run flawlessly in browsers so far, but seems to be transformed into ES5 after the update. Unfortunately, the result is not fully functional. As we do not want to rewrite the working ES6 code - how can I turn off this preprocessor?

 

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @IS24Tom ,

 

In AEM 6.5, the JavaScript files are transpiled from ES6 to ES5 using a preprocessor called Babel by default. This is done to ensure compatibility with older browsers that may not support ES6 syntax. If you want to disable this preprocessor and use your ES6 code directly without transformation, you can follow below steps:

  1. Inside the definition file, look for the jsProcessor property. It is set to default by default, which indicates that Babel is used for transpiling.

  2. Change the value of the jsProcessor property to none. This disables the preprocessor and prevents the ES6 to ES5 transformation.

View solution in original post

5 Replies

Avatar

Correct answer by
Community Advisor

Hi @IS24Tom ,

 

In AEM 6.5, the JavaScript files are transpiled from ES6 to ES5 using a preprocessor called Babel by default. This is done to ensure compatibility with older browsers that may not support ES6 syntax. If you want to disable this preprocessor and use your ES6 code directly without transformation, you can follow below steps:

  1. Inside the definition file, look for the jsProcessor property. It is set to default by default, which indicates that Babel is used for transpiling.

  2. Change the value of the jsProcessor property to none. This disables the preprocessor and prevents the ES6 to ES5 transformation.

Avatar

Level 1

I had already tried that. However, without success. Moreover, this came with the last update from 6.5.11 to 6.5.17.

Avatar

Level 1

I probably don't know something, because I changed 

categories="[cq.authoring.dialog]"

 to

categories="[cq.authoring.dialog.all]"

it works. Is there some magic behind the dialog categories, that I should know? 

Avatar

Community Advisor

It is strange ,because the cq.authoring.dialog category is a default category that is commonly used for dialog fields that are intended for authoring purpose. But using categories="[cq.authoring.dialog.all]", you are including all available dialog field types in the category selection for your dialog. This allows you to have access to a wider range of field types when configuring your dialog.

Avatar

Community Advisor

Hi @IS24Tom ,

You can override the default aem minification by adding following property in ClientLibraryFolder:

jsProcessor="[default:none,min:none]"