Disable payload extraction for `nuxi build`
See original GitHub issueFollowup https://github.com/nuxt/framework/pull/8890 by @danielroe
There are currently some uncertain decisions about the final API and behavior with payload extraction behavior like how we apply payload updates on CSR route change (should the key of static payload be prefixed with routes as well or remain global same as asyncData keys). (Tracker issue: #6411)
Making the decision to enable this feature or not is a tricky one because on one hand, we are really close to v3.0.0 release deadline and we don’t want to mark a functionality as stable and change it in a semver-minor release and on the other hand, payload extraction is an essential feature for the release with full static generation support.
I suggest two behaviors:
- For
nuxt build
when we have a server and the possibility of having hybrid prerendering, disable an option by default. Payload extraction will be always opt-in in Nuxt 3 for server mode.- Docs: Deploy>Node.js Server https://v3.nuxtjs.org/getting-started/deployment#nodejs-server
- For
nuxt generate
when we are expected to output a “full static” output, enable the future- Update the docs and warn about the stability of
nuxt generate
- Explain how payload extraction works and what are consequences of disabling it (needing a server)
- Docs: Deploy> Static Hosting https://v3.nuxtjs.org/getting-started/deployment#static-hosting
- Update the docs and warn about the stability of
An alternative is to always disable feature until we are really sure it is stable but there are few downsides:
- Enabling it by default for
nuxt generate
, even if super stable, is still a breaking change considering we essentially change caching strategy - Enabling it with a new flag (nuxt2 was
target: 'static'
) is less intuitive for starter users and even more confusing to explain - Differing to enable, means also less usage of the feature and harder to ever stabilize it
Issue Analytics
- State:
- Created 10 months ago
- Reactions:2
- Comments:6 (4 by maintainers)
Happy to disable it by default for
nuxi build
and enable it fornuxi generate
Hey @pi0, yes we are using the
nitro.prerender.routes
option and filling it with routes that we need to prerender. The thing is that we wanted to use the routes option to prerender the pages in order to deploy as a static website but to still have the option to build in server mode in order to deploy on our staging server, where pages should not be pre-rendered at all.