Skip to content

Non-SSR'd pages should be prerendered by default #3966

@Rich-Harris

Description

@Rich-Harris

Describe the problem

While we recommend that people use SSR as widely as possible, some apps don't. In these cases, there's no obvious reason not to prerender the shell page.

Describe the proposed solution

If a page is rendered with ssr: false, don't bail out during prerendering here, unless export const prerender is explicitly false (to provide an escape hatch when the app is doing something funky in handle):

if (!leaf.prerender && state.prerender && !state.prerender.all) {
// if the page has `export const prerender = true`, continue,
// otherwise bail out at this point
return new Response(undefined, {
status: 204
});
}

Alternatives considered

The alternative is to continue dynamically server-rendering empty pages. Totally fine, since rendering an empty page is cheap, but wasteful nonetheless.

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature / enhancementNew feature or requestp2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions