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.
So we have two main issues:
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
AEM clientlibs won't support much of the standard attributes at the moment. not even async, defer etc.
You can follow  to extend clientlibs and update this implementation to support 'type' property
 - http://www.nateyolles.com/blog/2016/06/custom-aem-html5-async-clientlibs