This request would need to be limited to dynamic import, but I think it is a real need as long as import is being visited...
Currently modules (as well as modules targeted by your proposal), being run asynchronously, do not allow modules to keep things fully modular by defining stylesheets synchronously so that any subsequent use of custom tags by users can take effect without flickering, placeholders, etc:
const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('src', 'module-specific-styling-without-flickering.css');
document.head.appendChild(link);
class CustomElementClass extends HTMLElement {...}
customElements.define('x-you-can-use-me-immediately-in-your-static-html', CustomElementClass);
export default CustomElementClass;
The same may be useful for JavaScript polyfills expressed as modules (or a series of interconnected modules) which the user may wish to import and use within the head of the document (without adding script tags for them non-modularly).
This request would need to be limited to dynamic import, but I think it is a real need as long as import is being visited...
Currently modules (as well as modules targeted by your proposal), being run asynchronously, do not allow modules to keep things fully modular by defining stylesheets synchronously so that any subsequent use of custom tags by users can take effect without flickering, placeholders, etc:
The same may be useful for JavaScript polyfills expressed as modules (or a series of interconnected modules) which the user may wish to import and use within the head of the document (without adding script tags for them non-modularly).