github / github/catalyst

Component not being rendered with Vite + preact-ts template

Offen
#298 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
1.4k
Forks
59
Ø Merge
22 Std. 12 Min.
Gemergte PRs (30 T.)
5

Beschreibung

Using ` plugins: [ preact() ]` in `vite.config.js`

Tried to create a basic component, as shown in the guide:
```js
import {controller} from '@github/catalyst';

@controller
class TestThingElement extends HTMLElement {

connectedCallback() {
this.innerHTML = 'Hello World!';
}
}
```

Then use it from HTML:
```html

```

Nothing gets rendered on the page, and there's no errors. However, if I don't use the `@controller` decorator, or if I remove the preact plugin, it does work. I looked at the transpiled code and noticed this:
```js
let TestThingElement = controller(_class = class TestThingElement2 extends HTMLElement {
```

Any idea what's going on here? I assume this is causing problems with how Catalyst uses the class name to determine the custom element tag.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the Vite configuration using the preact plugin and reproduce the issue from the preact-ts template. Compare the transpiled decorator output with the working version without the plugin; done means the @controller-decorated custom element renders in the HTML while the preact plugin remains enabled.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript, vite
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.