Render Svelte inside worker bundles by putting the compiler in Rolldown, not the app shell
When a worker-only fetch surface or Durable Object imports , add the Svelte compiler to . That compilation belongs to Devflare’s worker bundler, not the main Vite plugin chain.
This is the right path when the worker itself renders or consumes Svelte components. Keep the package in worker-only mode if that is all you need, then extend Devflare’s Rolldown pipeline with the Svelte plugins that make those imports compile cleanly.
- Best for
- Worker-only fetch surfaces or Durable Objects that import
- Key extension point
- Rendering shape
- SSR-style component compilation inside the worker bundle
Use this path when the worker imports the component
If your worker entry, route module, queue consumer, scheduled handler, or Durable Object imports a file directly, Devflare treats that as a worker bundling concern. The correct place to teach the build how to compile it is the Rolldown pipeline that Devflare owns for worker bundles.
That means you do not need to promote the whole package into a Vite app just because one worker module wants Svelte-based rendering. Worker-only mode remains the intended default until the package truly needs an outer app host.
Keep the ownership line clean
Vite owns the outer app shell when one exists. Rolldown owns the worker code that Devflare bundles itself. Worker-rendered Svelte belongs to the second bucket.
Add Svelte to Rolldown options
- keeps the worker bundle single-file instead of emitting a CSS asset pipeline the worker cannot naturally serve by itself.
- ssr`` fits worker-side rendering better than a browser DOM target.
- helps files and packages resolve cleanly.
Install the worker-side Svelte toolchain
Configure Svelte in `rolldown.options.plugins`
Render from the worker like any other module import
Do not over-generalize the plugin stack
If a plugin depends on Rollup-only hooks that Rolldown does not support yet, keep that plugin in the main Vite build instead of the worker bundler.
`src/Greeting.svelte`
`src/fetch.ts`
Previous
Test helper reference
Use this reference when you know you need the test package but not which helper surface is the smallest truthful proof.
Next
Vite standalone
An effective Vite config is what opts the package into Vite-backed flows: a local , a non-empty , or both together. Use when the package really is a Vite app and you want Devflare to keep Worker config, Durable Objects, and generated Wrangler output aligned underneath it.