Expand my Community achievements bar.

SOLVED

Minification

Avatar

Level 2

Is there any way to minify the embed libraries

embed="[jquery,granite.utils,granite.jquery,cq.jquery,granite.shared,cq.shared,underscore]"

in the client library folder

1 Accepted Solution

Avatar

Correct answer by
Employee

Yes it should work.

 

What tends to happen though is that these 3rd party libraries are using some version of ECMASCRIPT that is newer than what GCC supports. So the minification fails for a specific library. The GCC processor will log something like : 

 

ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.

 

 

Do a manual rebuild of the clientlibs here :  http://<aem>:<port>/libs/granite/ui/content/dumplibs.rebuild.html

 

This will take a while but it will recompile everything on the filesystem here : 

<u+2068>crx-quickstart<u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleXXX<u+2069> ▸ <u+2068>data<u+2069> ▸ <u+2068>outputcache<u+2069>

Search for the <u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleoutputcachethe <u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bu folder, there is only one.ad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleXXX<u+2069>

 nbsp;Editable lia-copypaste-placeholder ▸

And tail the logs for errors like while the client libs rebuild:▸ <u+2068>outp nbsp;il the lo

 nbsp;il the lo

25.02.2020 10:53:23.094 *ERROR* [0:0:0:0:0:0:0:1 [1582645978421] POST /libs/granite/ui/content/dumplibs.rebuild.html HTTP/1.1] com.google.javascript.jscomp /apps/myclientlib/clientlibs/clientlib-base.js:30499: ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.
25.02.2020 10:53:23.094 *ERROR* [0:0:0:0:0:0:0:1 [1582645978421] POST /libs/granite/ui/content/dumplibs.rebuild.html HTTP/1.1] com.adobe.granite.ui.clientlibs.processor.gcc.impl.GCCScriptProcessor Processed /apps/myclientlib/clientlibs/clientlib-base.js. 1 error(s), 1 warning(s)

 

 

 

Look for the client library and open both with normal and minified files in a text editor and manually observe if the clientlib minified or not.

 

Using my example error above the way to resolve this is to specific the languageIn and languageOut values on the jsProcessor property 

 

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

 

 

Generally you troubleshoot these on a case by case basis but you need to figure out why the minification fails. 

 

Hope that helps

 

 

View solution in original post

3 Replies

Avatar

Correct answer by
Employee

Yes it should work.

 

What tends to happen though is that these 3rd party libraries are using some version of ECMASCRIPT that is newer than what GCC supports. So the minification fails for a specific library. The GCC processor will log something like : 

 

ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.

 

 

Do a manual rebuild of the clientlibs here :  http://<aem>:<port>/libs/granite/ui/content/dumplibs.rebuild.html

 

This will take a while but it will recompile everything on the filesystem here : 

<u+2068>crx-quickstart<u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleXXX<u+2069> ▸ <u+2068>data<u+2069> ▸ <u+2068>outputcache<u+2069>

Search for the <u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleoutputcachethe <u+2069> ▸ <u+2068>launchpad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bu folder, there is only one.ad<u+2069> ▸ <u+2068>felix<u+2069> ▸ <u+2068>bundleXXX<u+2069>

 nbsp;Editable lia-copypaste-placeholder ▸

And tail the logs for errors like while the client libs rebuild:▸ <u+2068>outp nbsp;il the lo

 nbsp;il the lo

25.02.2020 10:53:23.094 *ERROR* [0:0:0:0:0:0:0:1 [1582645978421] POST /libs/granite/ui/content/dumplibs.rebuild.html HTTP/1.1] com.google.javascript.jscomp /apps/myclientlib/clientlibs/clientlib-base.js:30499: ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.
25.02.2020 10:53:23.094 *ERROR* [0:0:0:0:0:0:0:1 [1582645978421] POST /libs/granite/ui/content/dumplibs.rebuild.html HTTP/1.1] com.adobe.granite.ui.clientlibs.processor.gcc.impl.GCCScriptProcessor Processed /apps/myclientlib/clientlibs/clientlib-base.js. 1 error(s), 1 warning(s)

 

 

 

Look for the client library and open both with normal and minified files in a text editor and manually observe if the clientlib minified or not.

 

Using my example error above the way to resolve this is to specific the languageIn and languageOut values on the jsProcessor property 

 

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

 

 

Generally you troubleshoot these on a case by case basis but you need to figure out why the minification fails. 

 

Hope that helps