Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

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.

6 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 2

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!!

Avatar

Level 2

I can't believe using type=module is still not supported in 2025. I mean we are talking about 1 single attribute.

Most of the modern frontend frameworks have switch to Vite that is leveraging ES Modules and still nothing for AEM https://github.com/vitejs/awesome-vite?tab=readme-ov-file#adobe-experience-manager.

You are falling behind Adobe.

Avatar

Level 2

I attempted to integrate Vite.js into our AEM project setup. However, during implementation, I encountered a significant architectural concern. Vite.js requires overriding the default client libraries, which typically reside under /libs. To make it work, it suggests moving or overriding these clientlibs under /apps, which directly contradicts Adobe’s recommended best practices.

According to Adobe's guidelines, client libraries under /libs are considered immutable and should not be overridden or modified in /apps, as this can lead to upgrade issues and unexpected behavior. Vite.js documentation itself flags this approach with a warning, acknowledging that it may violate platform-specific constraints.

Given this, using Vite.js in an AEM context should be approached with caution, especially if it involves overriding core clientlibs. It’s important to evaluate whether the benefits of Vite.js justify the potential risks to maintainability and compliance with Adobe’s standards.

 

Kirthika_0-1762150742165.png
please refer:

Introducing AEM Vite | AEM Community Blog Seeding - Adobe Experience League Community - 418713