DEV Community

loading...

Discussion on: Why I don't use web components

Collapse
chimon1984 profile image
Ryan Edge

Is it possible to inject Svelte components into an existing app without compiling them as web components?

Collapse
richharris profile image
Rich Harris Author

Yep, by default they compile to regular JavaScript classes

Collapse
chimon1984 profile image
Ryan Edge

Ah ok, we have been looking into using Stencil for some shared components. I assumed you could do this with Svelte but I couldn't find any examples.

Thread Thread
hyperpress profile image
John Teague • Edited

But even though Rich built in a way to compile for web components in Svelte, which at least admits the need to address them, he tells you it's not recommended.

Thread Thread
paulmaly profile image
PaulMaly

It's just a nice to have thing. Svelte is a compiler, so it can just change a target of compilation to WC. But not really many people in the community really use this opportunity.

Collapse
paulmaly profile image
PaulMaly

Please check this example of integration existing Svelte component (Twitter Card widget) to React application created with CRA: github.com/PaulMaly/react-svelte

Example a little bit outdated, but the main idea doesn't change.