Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Migrate conditional custom element compilation in Svelte Rollup config to SvelteKit Vite config

$
0
0

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?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>