mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-09 03:03:18 +00:00
docs: selective pre-rendering options (#20670)
This commit is contained in:
parent
47591c92ec
commit
30132f3603
@ -87,7 +87,19 @@ Use the [`nuxi generate` command](/docs/api/commands/generate) to build your app
|
|||||||
npx nuxi generate
|
npx nuxi generate
|
||||||
```
|
```
|
||||||
|
|
||||||
### Manual Pre-rendering
|
You can enable crawl-based pre-rendering when using `nuxt build` in the `nuxt.config` file:
|
||||||
|
|
||||||
|
```ts [nuxt.config.ts|js]
|
||||||
|
defineNuxtConfig({
|
||||||
|
nitro: {
|
||||||
|
prerender: {
|
||||||
|
crawlLinks: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Selective Pre-rendering
|
||||||
|
|
||||||
You can manually specify routes that [Nitro](/docs/guide/concepts/server-engine) will fetch and pre-render during the build.
|
You can manually specify routes that [Nitro](/docs/guide/concepts/server-engine) will fetch and pre-render during the build.
|
||||||
|
|
||||||
@ -101,6 +113,20 @@ defineNuxtConfig({
|
|||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When using this option with `nuxi build`, static payloads won't be generated by default at build time. For now, selective payload generation is under an experimental flag.
|
||||||
|
|
||||||
|
```ts [nuxt.config.ts|js]
|
||||||
|
defineNuxtConfig({
|
||||||
|
/* The /dynamic route won't be crawled */
|
||||||
|
nitro: {
|
||||||
|
prerender: { crawlLinks: true, ignore: ['/dynamic'] }
|
||||||
|
},
|
||||||
|
experimental: {
|
||||||
|
payloadExtraction: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
### Client-side Only Rendering
|
### Client-side Only Rendering
|
||||||
|
|
||||||
If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `.output/public/index.html` entrypoint and JavaScript bundles like a classic client-side Vue.js application.
|
If you don't want to pre-render your routes, another way of using static hosting is to set the `ssr` property to `false` in the `nuxt.config` file. The `nuxi generate` command will then output an `.output/public/index.html` entrypoint and JavaScript bundles like a classic client-side Vue.js application.
|
||||||
|
Loading…
Reference in New Issue
Block a user