Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM 6.5 - StencilJS Integration


Level 3

Hi all,


We are trying to create a web component using stencilJS and integrate it into AEM 6.5.
StencilJS builds the web component using rollup and creates two different loaders, depending on the browser: The ESM and the ES5+polyfills loader.


The way we link the components to the HTML is:
<script type="module" src="/build/my-component-library.esm.js"></script>
<script nomodule="" src="/build/my-component-library.js"></script>


And the script lazy loads each Web component asynchronously.


We've tried to install it as a ClientLib but when we reference it on the AEM component, it bundles all JS in one file and it does not create the script tag with type module.


How to load a ClientLib that uses ES Modules?


We have been thinking about the following solution:

  • Create a client lib in AEM and copy all the Stencil build files inside the resources folder.
  • Create the main JavaScript file for the clientlib that, in execution time, renders into the DOM the two scripts tags (ESM and ES5) from the resources folder.
  • Create the sly tag to use the clientlib.


but I would like to know if there is a standard solution from AEM?


Thanks in advance


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

0 Replies