Clientlibs not getting minified in AEM 6.5.6 | Community
Skip to main content
New Participant
May 18, 2022
Solved

Clientlibs not getting minified in AEM 6.5.6

  • May 18, 2022
  • 3 replies
  • 4952 views

The .min.js extension is getting added to the client library , but the js files are not minified.
AEM version: 6.5 and service pack version is 6.5.6.
In OSGI config HTML client library manager, minify option is already enabled with jsProcessor= min:gcc 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by joerghoh

Can you elaborate on the Frontend build process please


The standard AEM archetype provides a pre-defined structure for the frontend build already, see https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetype/using.html?lang=en#what-you-get

 

specifically the modules "ui.frontend.general", "ui.frontend.react" and "ui.frontend.angular"

3 replies

joerghoh
Employee
May 18, 2022

I would do the minification outside as part of the Frontend build process; I would not rely on the AEM features, because there are better ways and tools to do so.

 

(Note: hearsay, I am not a frontend engineer)

DEBAL_DAS
New Participant
May 19, 2022

Yes @joerghoh , in our current and last project minification is part of Frontend build process.

nitin029Author
New Participant
May 19, 2022

Can you elaborate on the Frontend build process please

DEBAL_DAS
New Participant
May 18, 2022

Steps:1

Please check error.log file there you might see some error associated with that clientlib.

When I had issue with minification , I saw error message in error.log file and then I took necessary steps to fix.

 

Step:2

To troubleshoot the issue please follow the below steps   -

 

a. AEM 6.5 uses following closure-compiler-v20190121.jar for js minification, also highlighted in below screenshot -

 

b. If we take a closure look , we could see com.google.javascript is part of this closure compiler bundle.

c. Next you  can download the bundle:closure-compiler-v20190121.jar from aeminstance\crx-quickstart\launchpad\felix\bundle290\version0.0\bundle.jar-embedded. Bundle ID may vary in your case-

 

d. To understand the minification issue , you can execute below command to compile the Javascript file -

     java -jar compiler.jar --js hello.js --js_output_file hello-compiled.js

[https://developers.google.com/closure/compiler/docs/gettingstarted_app]

It may throw error during compilation and it will help you why minification isn't working.

 

 

 

nitin029Author
New Participant
May 18, 2022

Hi @debal_das , this is the error that is coming in the logs:

18.05.2022 13:49:18.996 *ERROR* [0:0:0:0:0:0:0:1 [1652861958525] GET /etc.clientlibs/deg/clientlibs/clientlib-base.min.js HTTP/1.1] com.google.javascript.jscomp /apps/deg/clientlibs/clientlib-base.js:849: ERROR - This language feature is only supported for ECMASCRIPT6 mode or better: block-scoped function declaration.
function checkDOMChangeLogin()
^

There were other errors regarding the usage of let keyword which I already have neutralized. But this is the only error coming up now.
Any suggestions on how to neutralize this one?

Thanks

DEBAL_DAS
New Participant
May 18, 2022

You can give a try by adding either one of the below option in that clientlibrary folder: 

a.

jsProcessor=[min:gcc;languageIn=ECMASCRIPT_2016;languageOut=ECMASCRIPT_2016;compilationLevel=simple;obfuscate=true]

b.

 jsProcessor=[min:gcc;obfuscate=true;languageIn=ECMASCRIPT_2019;languageOut=ECMASCRIPT3]

 

 

One more request please talk to your Front End developers and Front End architect about this error, if they could fix this issue at code level.