- From: Frederik Bosch <notifications@github.com>
- Date: Thu, 10 Apr 2025 23:58:30 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 11 April 2025 06:58:34 UTC
frederikbosch left a comment (WICG/webcomponents#782) Another approach - I believe I have not seen it - is to solve this via the `import` side. Why not extend the `importmap` specification with a `custom-elements` key? ```json { "custom-elements": { "my-element": "import/default/from/file.js", "another-element": { "import": { "file": "import/from/file.js" "name": "register" } } } } ``` ```js // import/default/from/file.js class MyElement extends HTMLElement {} export default function(tagName) { if (tagName === 'my-element') { customElements.define('my-element', MyElement); } } // import/default/from/file.js class AnotherElement extends HTMLElement {} export function register(tagName) { if (tagName === 'another-element') { customElements.define('another-element', AnotherElement); } } ``` -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/782#issuecomment-2796022743 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/782/2796022743@github.com>
Received on Friday, 11 April 2025 06:58:34 UTC