Hello guys,
I have an issue regarding using ES6 functions which is after minifying the JS, it seems it doesn't support it. Any input is appreciated. Thank you !
Views
Replies
Total Likes
Please check these articles
Hope that helps you!
Regards,
Santosh
Hi @AEMStarterNewbie ,
Are you generating a webpack sorta js and adding the same to the clientlibs and post that the code is not working fine?
You can override the default aem minification by adding following property in ClientLibraryFolder:
jsProcessor="[default:none,min:none]"
Let me know if that doesnt help or there is a gap in my understanding.
Thanks,
Milind
Yes, I have run into the same issue, minification to ES6 scripts & functions is coming up with a blank file.
As @milind_bachani suggested, you can either turn off minification through js:Processor property.
A drawback with that would be, your code would be AS-IS and unminified which can be acessed through the dev console of browsers.
To solve this issue, you can place your script in the ui.frontend module and build it through webpack. Use babel and minifify during building itself.
Then you can turn off minification in AEM(CRX) and you would have minified code.
Try to update your clientlibrary 'jsprocessor' property with below.
jsProcessor="[min:gcc;languageIn=ECMASCRIPT_2016;languageOut=ECMASCRIPT_2016;compilationLevel=simple;obfuscate=true]"
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
Getting Started with the Closure Compiler Application | Google Developers
It may throw error during compilation and it will help you why minification isn't working.
In my project Front End developers do the minification outside as part of the Frontend build process; Front End devs would not rely on the AEM features, because there are better ways and tools to do so.
Views
Likes
Replies
Views
Likes
Replies