mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 17:32:31 +00:00
feat(nuxi): warn when prerendering routes with ssr: false
(#18783)
This commit is contained in:
parent
39747ce095
commit
85881b462b
@ -76,8 +76,8 @@ By default, the workload gets distributed to the workers with the round robin st
|
|||||||
|
|
||||||
There are two ways to deploy a Nuxt application to any static hosting services:
|
There are two ways to deploy a Nuxt application to any static hosting services:
|
||||||
|
|
||||||
- Static site generation (SSG) pre-renders routes of your application at build time.
|
- Static site generation (SSG) with `ssr: true` pre-renders routes of your application at build time. (This is the default behaviour when running `nuxi generate`.) It will also generate `/200.html` and `/404.html` single-page app fallback pages, which can render dynamic routes or 404 errors on the client (though you may need to configure this on your static host).
|
||||||
- Using `ssr: false` to produce a pure client-side output.
|
- Alternatively, you can prerender your site with `ssr: false` (static single-page app). This will produce HTML pages with an empty `<div id="__nuxt"></div>` where your Vue app would normally be rendered. You will lose many of the benefits of prerendering your site, so it is suggested instead to use `<ClientOnly>` to wrap the portions of your site that cannot be server rendered (if any).
|
||||||
|
|
||||||
### Crawl-based Pre-rendering
|
### Crawl-based Pre-rendering
|
||||||
|
|
||||||
|
@ -52,6 +52,9 @@ export default defineNuxtCommand({
|
|||||||
await buildNuxt(nuxt)
|
await buildNuxt(nuxt)
|
||||||
|
|
||||||
if (args.prerender) {
|
if (args.prerender) {
|
||||||
|
if (!nuxt.options.ssr) {
|
||||||
|
consola.warn('HTML content not prerendered because `ssr: false` was set. You can read more in `https://nuxt.com/docs/getting-started/deployment#static-hosting`.')
|
||||||
|
}
|
||||||
// TODO: revisit later if/when nuxt build --prerender will output hybrid
|
// TODO: revisit later if/when nuxt build --prerender will output hybrid
|
||||||
const dir = nitro?.options.output.publicDir
|
const dir = nitro?.options.output.publicDir
|
||||||
const publicDir = dir ? relative(process.cwd(), dir) : '.output/public'
|
const publicDir = dir ? relative(process.cwd(), dir) : '.output/public'
|
||||||
|
Loading…
Reference in New Issue
Block a user