QwikDev/qwik

[✨] Pre-render at build time paths specified by `onStaticGenerate` in Vercel adapter

Opened this issue · 0 comments

Is your feature request related to a problem?

Most routes in my project are static and thus can be pre-rendered at build time. But not all of them are, and so I cannot use the static adapter. This results in higher-than-otherwise TTFB. Many of my pages are intended to rank for long-tail (i.e, low traffic) keywords on search engines, and so rarely get more than 1 visit between builds and thus would not benefit much from just specifying cache controls.

Describe the solution you'd like

All paths specified by onStaticGenerate in every route are pre-rendered as part of the build when using the Vercel adapter. These paths are then served from cache in response to the first request for this path. Routes still respect cacheControl, e.g. will regenerate the route after max-age time has elapsed.

Describe alternatives you've considered

Static Adapter: does not allow for route regeneration, does not do SSR for paths not specified by onStaticGenerate

Additional context

NextJS implements similar functionality:

If fallback is 'blocking', new paths not returned by getStaticPaths will wait for the HTML to be generated, identical to SSR (hence why blocking), and then be cached for future requests so it only happens once per path.

(Note that the various fallback options described in these docs are not part of this feature request; I've provided this just as a reference for how another framework implements a similar feature)