In my Svelte 3 component library I’m using this Rollup configuration to conditionally render custom elements. Only files with the *.wc.svelte
extension are compiled as HTML5 web components.
export default {
...
plugins: [
/** Handle HTML5 Web Components **/
sveltekit({
include: /.wc.svelte$/,
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
customElement: true,
},
// store CSS in JavaScript
emitCss: false,
}),
/** Handle Svelte Components **/
sveltekit({
exclude: /.wc.svelte$/,
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
customElement: false,
},
// we'll extract any component CSS out into
// a separate file - better for performance
emitCss: true,
}),
]
Now I’m migrating to Svelte 4 / SvelteKit.
How can I translate the same behaviour to the Vite configuration?