Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Add type="module" to the script tag when AEM introduces JS

Avatar

Level 2

guodongha_0-1731393613988.png

guodongha_1-1731393632712.png

 

Unable to successfully add type='module', expected the following result

 

guodongha_2-1731393701931.png

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor

Hi,

If you are using core components then you can load clientlibs with type=media using core component Template or Sling Model

 

https://github.com/adobe/aem-core-wcm-components/blob/081c26da731047659642e7863345b69b07bb931f/conte... 

 

https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wc... 

Arun Patidar

AEM LinksLinkedIn

Avatar

Community Advisor

Hi @guodongha 

 

Can you try to add languageIn and languageOut flags ?

Something like:

jsProcessor="[default:none,min:none;languageIn=ECMASCRIPT_2021;languageOut=ECMASCRIPT_2021]"

Available options are in the documentation: https://github.com/google/closure-compiler/wiki/Flags-and-Options

 

Tethich_1-1731436676961.png

 

 

 

Avatar

Level 1

This is not correct answer.

 

All this options are just for a JS code compiler, not related at all how html script tag is rendered.

Avatar

Level 1

Yes! This is not correct answer, I tired didn't worked out.

Please anyone suggest for adding type=module dynamically from AEM clientlibs .

Thanks in Advance!!