Abstract
We all know that minification allows us to reduce the size of the files being requested.
We also know that AEM provides an OOTB OSGi configuration to enable minification on the instances which in time will reduce the size of the Javascript (JS)/CSS files being requested, improving the loading time of the pages.
But many times minification didn’t work despite being this AEM OOTB OSGi configuration enabled on AEM clientlibs.
Personally I had encountered this issue and even I have seen several posts specially with ECMASCRIPT6 minification isn’t working or clientlib isn’t getting minified.
Now I will talk about how can we debug this issue here.
Approach:1
Like any other issue we always start the debug with log file so, no exception in this case also.
We need to check error.log file of the relevant AEM instance and then search with the file name like clientlib.min.js or clientlib.js
Please don’t get confused with .min. in that file name. I know it looks like file gets minified but it actually don’t.
Here definitely you will be seeing some error associated with that clientlib like the below one -
ERROR* [0:0:0:0:0:0:0:1 [1652861958525] GET ……
ECMASCRIPT6 mode or better: block-scoped function declaration.
When I had this minification issue, immediately I shared the error message with Front End team and then they took necessary steps to fix this issue.
We can go one step further and follow below approach also -
Approach:2
To troubleshoot the issue we need to follow the below steps -
a. AEM 6.5 uses following closure-compiler-v20190121.jar for Javascript minification,
Read Full Blog
Q&A
Please use this thread to ask the related questions.
Kautuk Sahni