-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Describe the problem
For large headless / static sites with a bit of api glue code, marking every single route with export const prerender = true is both unergonomic and unintuitive, considering other major serverless frameworks (eg: Next) automatically prerender all routes when possible.
A common pattern is to have all routes prerendered, and then an api/ route or similar for endpoints that would get translated to serverless functions you can request to.
Describe the proposed solution
There should be an option to make prerendering opt-out rather than opt-in for serverless adapters. Ideally an adapter like Vercel should attempt to prerender all routes by default, while keeping endpoints as serverless functions. That would be a fairly major breaking change, so making this a configuration option (false by default) would be a non-breaking and huge erganomic upgrade. Though I still think the default behaviour is odd, given kit's emphasis on performance and DX.
Alternatives considered
- Mark every route with
export const prerender = true, unintuitive and prone to user-error - Use
adapter-staticand manually deploy serverless functions for api routes / endpoints to provider of choice, largely negating the whole benefit of Sveltekit's deep serverless integration
Importance
nice to have
Additional Information
No response