Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new

Learn more

View all

Sign in to view all badges

AEM 6.5 - StencilJS Integration

Level 2
Level 2

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

6.5 Integrations
0 Replies