Highlighted

AEM 6.5.2 JS files are not minified with gcc and yui

divyas70997717

13-05-2020

Hi,

 

JS minify is not happening in AEM 6.5.2 instance for our project. I tried with gcc (min:gcc;languageIn=ECMASCRIPT6) with Adobe Granite HTML Library Manager and also tried with default minify (min:yui). Both seems not working.

 

Thanks in Advance.

Replies

Highlighted

Ankur_Khare

MVP

14-05-2020

Could you please try to minify your js here-

https://www.freeformatter.com/javascript-minifier.html

 

If it works here then we can check in aem , nor it should not work online only there must be some error in your js file, due to which you are not able to minify the js.

Highlighted

divyas70997717

14-05-2020

Thank you for your response. I tried minifying using the free formatter and it throws an error in JS files. Basically it throws an error in lines which used "let" keyword. Does min:gcc not support let?
Highlighted

divyas70997717

14-05-2020

I fixed all the errors and it works in freeformatter. But no effect in AEM and still it is not minified in AEM (version 6.5.2)
Highlighted

divyas70997717

14-05-2020

The following is the error that i can see it in error.log but the error is very uncertain. Very rarely i get this.

ERROR [com.adobe.granite.ui.clientlibs.processor.gcc.impl.GCCScriptProcessor] Error setting compiler options for flags {minify=true, languageIn=ECMASCRIPT6}: No enum constant com.google.javascript.jscomp.CompilerOptions.LanguageMode.ECMASCRIPT6

 

DEBUG [com.adobe.granite.ui.clientlibs.impl.HtmlLibraryBuilderImpl] processing {My clientlibrary path} with processor gcc for mode min rejected.

Tried with min:yui and i could not see any errors but no result either.

Highlighted

Theo_Pendle

MVP

14-05-2020

Hi @divyas70997717 ,

I see that you are trying to use ECMASCRIPT6 as an option for gcc.

"gcc" stands for Google Closure Compiler. There seems to be no ECMASCRIPT6 option for languageIn, you'll have to pick one from the following list (which I got from the documentation on GCC's GitHub page😞

ECMASCRIPT3
ECMASCRIPT5
ECMASCRIPT5_STRICT
ECMASCRIPT6_TYPED (experimental)
ECMASCRIPT_2015
ECMASCRIPT_2016
ECMASCRIPT_2017
ECMASCRIPT_2018
ECMASCRIPT_2019
STABLE
ECMASCRIPT_NEXT

ECMASCRIPT_2015 is equivalent to ES6 btw: https://www.w3schools.com/js/js_es6.asp

Hope this helps, let me know  🙂

Highlighted

divyas70997717

14-05-2020

Thank you for your response. I have already tried ECMASCRIPT_2015 and also with other options. It did not work out so i have used ECMASCRIPT6 option.
Highlighted