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:
but I would like to know if there is a standard solution from AEM?
Thanks in advance