svelte-v4-custom-elements-define Svelte Themes

Svelte V4 Custom Elements Define

Repro for issue #8681

svelte-v4-custom-elements-define

Demos an issue with manually defining custom elements in Svelte 4 (pre-release) using customElements.define().

Get started

Init repo

git clone https://github.com/patricknelson/svelte-v4-custom-elements-define.git
cd svelte-v4-custom-elements-define
npm i

Reproduce bug

git checkout main
npm run dev

Test workaround

git checkout workaround
npm run dev

From scratch

Init base files

# select Svelte + JavaScript
npm init vite

# Install but overwrite with Svelte v4
npm i -D [email protected]

Update Svelte compiler options in vite.config.js to enable custom elements, i.e. customElement: true.

Top categories

Loading Svelte Themes