kit icon indicating copy to clipboard operation
kit copied to clipboard

Disable generation of server code

Open janopae opened this issue 1 year ago • 2 comments

Describe the problem

SvelteKit seems to always generate files to the .svelte-kit/output/server/ directory – even with export const ssr = false in src/routes/+layout.ts, and even with the static adapter and prerender set to false.

That doesn't seem to make sense if only client code will be shipped.

Describe the proposed solution

It would be great to have a configuration option that disables all generation of server side JavaScript code. This would save build time, disk space, and therefore energy consumption in all local, server-side and CI-based cases where SvelteKit builds are executed.

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

janopae avatar Aug 07 '24 14:08 janopae

I'm using SvelteKit, but with a Flask backend. I have no use for the server part of SvelteKit; I only want to use the routing. The additional build takes extra time and is noisy (since I don't use it). Please enable us to disable it. IMO the routing and server functionality shouldn't be coupled. It makes SvelteKit less desirable if it's all-or-nothing.

ilyakamens avatar Aug 17 '24 07:08 ilyakamens

This might be more feasible once we've moved to the Vite Environment API

  • https://main.vitejs.dev/guide/api-environment

teemingc avatar Oct 25 '24 10:10 teemingc