Custom Elements in Svelte

Svelte Apr. 06, 2020

My first svelt app was a youtube playlist player ( I was pretty surprised by the simple syntax and became a fanboy.
I think the future ist compiler and no virtual dom. That said, I ran into several issues, trying to migrate the app (iFrame in my website)  into a web component:

  1. every svelte component within your project must be exported as CE
    <svelte:options tag="youtube-item"  />
    (language server is complaining about missing cusstomElement:true in rollup config anyway)

2. styles are not compiled in subcomponents - known Bug:

So I decided to import the file by link tag.  The link is relative to the root element and import.meta.url is not available.

The workarounds are not very appealing, so I skipt working on this small “project” and decided to have a look in 6 month.

Tobias Wolter

Intranet & Webanwendungen mit React, Svelte und einem Go-Backend.