AEM 6.5.2 JS files are not minified with gcc and yui

Avatar

Avatar

divyas70997717

Avatar

divyas70997717

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

Avatar

Avatar

Ankur_Khare

MVP

Avatar

Ankur_Khare

MVP

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.

Avatar

Avatar

divyas70997717

Avatar

divyas70997717

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?

Avatar

Avatar

Ankur_Khare

MVP

Avatar

Ankur_Khare

MVP

Ankur_Khare
MVP

14-05-2020

yes it wont you need to fix all these errors

Avatar

Avatar

divyas70997717

Avatar

divyas70997717

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)

Avatar

Avatar

Ankur_Khare

MVP

Avatar

Ankur_Khare

MVP

Ankur_Khare
MVP

14-05-2020

check the logs and share the logs whats the error

Avatar

Avatar

divyas70997717

Avatar

divyas70997717

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.

Avatar

Avatar

Theo_Pendle

MVP

Avatar

Theo_Pendle

MVP

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  🙂

Avatar

Avatar

divyas70997717

Avatar

divyas70997717

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.

Avatar

Avatar

aemmarc

Employee

Avatar

aemmarc

Employee

aemmarc
Employee

14-05-2020

jsProcessor=[default:none,min:gcc;languageIn=ECMASCRIPT_2015;languageOut=ECMASCRIPT_2015]