-
-
Notifications
You must be signed in to change notification settings - Fork 117
Description
Describe the problem
When combined with @cloudflare/vite-plugin
, most deps are prebundled before they are loaded by the workerd
runtime during development. This means that the esbuild optimizer plugin should generate server code in these cases instead of always generating client code.
generate: 'client' |
This is important to enable SvelteKit to work with the Cloudflare Vite plugin in development, which currently receives client Svelte code when performing SSR.
Describe the proposed solution
The Svelte compiler generates client/server code depending on the Vite environment when optimizing dependencies.
EDIT: sapphi mentioned it's possible to set a different esbuild plugin during the configureEnvironment
hook
Alternatives considered
If we waited for Rolldown to officially replace esbuild, we wouldn't need to bother with tweaking the esbuild plugin. But I think that might still be a long time from now.
We could also probably workaround this by ensuring SvelteKit doesn't get optimized during development.
Importance
I cannot use vite-plugin-svelte without it