github / github/catalyst

Component not being rendered with Vite + preact-ts template

Đang mở
#298 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.4k
Fork
59
Merge trung bình
22 giờ 12 phút
Pull request đã merge (30 ngày)
5

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript, vite
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.