fix: dynamic base class import

This commit is contained in:
Ayo 2023-10-19 16:36:20 +02:00
parent b3c37ebb25
commit b25c0ef0dc
4 changed files with 4 additions and 4 deletions

View file

@ -88,6 +88,7 @@ async function insertRegistry(
async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
let registryScript = `<script type='module'>`;
let baseClassImported = false;
for (const name of usedCustomElements) {
const content = await useStorage().getItem(
@ -97,7 +98,6 @@ async function buildRegistry(usedCustomElements: string[], type: "js" | "ts") {
`class WebComponent {}; class HTMLElement {}; (${content.toString()})`
);
const className = new evalStore().constructor.name;
let baseClassImported = false;
if (
!baseClassImported &&

View file

@ -20,7 +20,7 @@
<main>
<a href="/demo/about">{{ count }}</a>
<div>
<hello-world name="{{name }}"></hello-world>
<my-hello-world name="{{name }}"></my-hello-world>
</div>
<p>some text: {{greeting}}</p>
{{greeting}} hey<br />
@ -28,7 +28,7 @@
</main>
<my-footer></my-footer>
<script>
const helloWorld = document.querySelector("hello-world");
const helloWorld = document.querySelector("my-hello-world");
setTimeout(() => {
helloWorld.setAttribute("name", "Nitro");
}, 2000);

View file

@ -10,7 +10,7 @@
</p>
<p>
Here's a sample interactive custom element:
<hello-world name="McFly"></hello-world>
<vanilla-hello-world name="McFly"></vanilla-hello-world>
</p>
<p>
Start at the very basic of writing HTML files and enhance with standard