-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prerendering overhaul #6356
Comments
always, never and sometimes seems logical to me, maybe a little odd. |
What about |
Normally I like |
I think
Think of CSS |
In the maybe/sometimes case, what controls whether the prerendering actually occurs? If the user has control then |
I don't think I also like the simplified |
At prerender time, 'maybe' and 'always' are identical, i.e. if the crawler can reach the page, it gets prerendered. The difference is whether the route is included in the SSR manifest — instead of only excluding routes with no dynamic parts (as currently happens), we can exclude all routes that are always prerendered, resulting in slimmer deployments. I can definitely see the appeal of I don't think it affects this proposal, but just going to throw this out there anyway: it's possible we'd want to use this value for incremental static regeneration (ISR) as well in future: export const prerender = {
incremental: true,
// cache for all users based on pathname (disregard cookies/searchParams/etc)
key: (event) => event.url.pathname,
// enable selective cache purging
tags: ['recipes']
}; |
In that case why not make it an optional opts object now for the advanced case? export const prerender: boolean | {
enabled: boolean;
excludeSSR: boolean;
} |
export const prerender: boolean | {
excludeSSR: boolean;
} ...which feels a bit to me in the absence of other options. If we do end up using this for ISR then it would be easy enough to treat |
That makes sense 👍🏼 Keen for |
Describe the problem
There's a few improvements that need to happen to prerendering that, while separate, are probably best tackled in one go. The broader context for this is #6197, in which it will be possible to set
export const prerender
in a layout — e.g. the root layout — such that it will be inherited by all pages within.prerender
should be an enum so that we can distinguish between pages that can be prerendered from those that must be prerendered. The latter can safely be excluded from the SSR manifest, whereas presently we can only exclude prerendered pages without dynamic parameters+server.js
files should be able to declare their prerenderability (or otherwise) as well.+server.js
files withPOST
etc cannot be prerendered.Describe the proposed solution
Must-prerender pages could be declared with
I'm not sure what a great name is for the current
prerender = true
(i.e. can-prerender). One suggestion was this......though I would be interested in alternative suggestions. (This isn't something you'd use often — only in cases where, for example, you want to prerender your 1,000 most popular blog posts or whatever and let the long tail be SSR'd, though #661 would be a better solution in the longer term.)
Since
+server.js
files are standalone — i.e. they don't have a+layout
to inherit from — the naive approach would be to make it necessary to declare the setting for every file individually, which is a pain. Instead, I think+server.js
files should inherit their prerenderability from the pages that request them during prerendering (i.e. if an endpoint is only fetched by a must-prerender page, it can be excluded; if it is fetched by a can-prerender page or isn't fetched at all, it must be included). If necessary, it can be made explicit withexport const prerender = value
.Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: