@nuxt/docs-nightly 4.6.0-29840865.55e61d75 → 4.6.0-29840992.7ccd5a64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/1.getting-started/02.installation.md +1 -3
- package/1.getting-started/15.prerendering.md +9 -15
- package/2.directory-structure/1.app/1.pages.md +1 -1
- package/2.directory-structure/3.tsconfig.md +1 -1
- package/3.guide/6.going-further/1.experimental-features.md +18 -0
- package/4.api/6.nuxt-config.md +4 -6
- package/package.json +1 -1
|
@@ -108,9 +108,7 @@ Well done! A browser window should automatically open for <http://localhost:3000
|
|
|
108
108
|
::
|
|
109
109
|
|
|
110
110
|
::tip{icon="i-lucide-container"}
|
|
111
|
-
If you're using Docker or want a consistent development environment across machines, consider using a dev container.
|
|
112
|
-
|
|
113
|
-
[Learn more about dev containers](/docs/guide/best-practices/devcontainers)
|
|
111
|
+
If you're using Docker or want a consistent development environment across machines, consider using a dev container. [Learn more about dev containers.](/docs/guide/best-practices/devcontainers)
|
|
114
112
|
::
|
|
115
113
|
|
|
116
114
|
::
|
|
@@ -44,7 +44,7 @@ Static and prerender builds also emit `200.html` and `404.html` SPA fallbacks. S
|
|
|
44
44
|
|
|
45
45
|
How the Nitro crawler works:
|
|
46
46
|
|
|
47
|
-
1. Load the HTML of your application's root route (`/`), any non-dynamic pages in your `~/pages` directory, and any other routes in the `
|
|
47
|
+
1. Load the HTML of your application's root route (`/`), any non-dynamic pages in your `~/pages` directory, and any other routes in the `prerender.routes` array.
|
|
48
48
|
2. Save the HTML and `_payload.json` to the `~/.output/public/` directory to be served statically.
|
|
49
49
|
3. Find all anchor tags (`<a href="...">`) in the HTML to navigate to other routes.
|
|
50
50
|
4. Repeat steps 1-3 for each anchor tag found until there are no more anchor tags to crawl.
|
|
@@ -57,16 +57,13 @@ Read more about the `nuxt generate` command.
|
|
|
57
57
|
|
|
58
58
|
### Selective Pre-rendering
|
|
59
59
|
|
|
60
|
-
You can manually specify routes that
|
|
60
|
+
You can manually specify routes that Nuxt will fetch and pre-render during the build or ignore routes that you don't want to pre-render like `/dynamic` in the `nuxt.config` file:
|
|
61
61
|
|
|
62
62
|
```ts twoslash [nuxt.config.ts]
|
|
63
|
-
// @errors: 2353
|
|
64
63
|
export default defineNuxtConfig({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
ignore: ['/dynamic'],
|
|
69
|
-
},
|
|
64
|
+
prerender: {
|
|
65
|
+
routes: ['/user/1', '/user/2'],
|
|
66
|
+
ignore: ['/dynamic'],
|
|
70
67
|
},
|
|
71
68
|
})
|
|
72
69
|
```
|
|
@@ -74,18 +71,15 @@ export default defineNuxtConfig({
|
|
|
74
71
|
You can combine this with the `crawlLinks` option to pre-render a set of routes that the crawler can't discover like your `/sitemap.xml` or `/robots.txt`:
|
|
75
72
|
|
|
76
73
|
```ts twoslash [nuxt.config.ts]
|
|
77
|
-
// @errors: 2353
|
|
78
74
|
export default defineNuxtConfig({
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
routes: ['/sitemap.xml', '/robots.txt'],
|
|
83
|
-
},
|
|
75
|
+
prerender: {
|
|
76
|
+
crawlLinks: true,
|
|
77
|
+
routes: ['/sitemap.xml', '/robots.txt'],
|
|
84
78
|
},
|
|
85
79
|
})
|
|
86
80
|
```
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
The top-level `prerender` option applies whichever `server.builder` you use. Builder-specific options, such as Nitro's `concurrency` or `failOnError`, can be set in `nitro.prerender`.
|
|
89
83
|
|
|
90
84
|
::read-more{to="https://nitro.build/config#prerender"}
|
|
91
85
|
Read more about pre-rendering in the Nitro documentation.
|
|
@@ -16,7 +16,7 @@ Pages are Vue components and can have any [valid extension](/docs/api/nuxt-confi
|
|
|
16
16
|
Nuxt will automatically create a route for every page in your `~/pages/` directory.
|
|
17
17
|
|
|
18
18
|
::tip
|
|
19
|
-
Pages are only automatically registered for prerendering if you have not disabled `
|
|
19
|
+
Pages are only automatically registered for prerendering if you have not disabled `prerender.crawlLinks` and you have at least one page in your `prerender.routes` list. See the [prerendering guide](/docs/getting-started/prerendering).
|
|
20
20
|
::
|
|
21
21
|
|
|
22
22
|
::code-group
|
|
@@ -76,5 +76,5 @@ Most `compilerOptions` set in `typescript.tsConfig` are shared with every contex
|
|
|
76
76
|
::
|
|
77
77
|
|
|
78
78
|
::note
|
|
79
|
-
`typescript.serverTsConfig`
|
|
79
|
+
`typescript.serverTsConfig` extends `tsconfig.server.json`. `nitro.typescript.tsConfig` is kept in sync with it but is deprecated, so set `typescript.serverTsConfig` instead.
|
|
80
80
|
::
|
|
@@ -278,6 +278,24 @@ export default defineNuxtConfig({
|
|
|
278
278
|
})
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
+
## serverPathFallback
|
|
282
|
+
|
|
283
|
+
Loads a client-side navigation that matches no page route as a full document, so the server can respond with a file in `public/`, a server route, or its 404 page. With this enabled, `<NuxtLink to="/brochure.pdf">` and `<NuxtLink to="/rss.xml">` work on click as they do on a hard load.
|
|
284
|
+
|
|
285
|
+
A path is never reloaded if the current document was already served for it, so hosts that respond to unknown paths with an SPA fallback render the client-side 404 page.
|
|
286
|
+
|
|
287
|
+
This flag is enabled by default, but you can disable it:
|
|
288
|
+
|
|
289
|
+
```ts twoslash [nuxt.config.ts]
|
|
290
|
+
export default defineNuxtConfig({
|
|
291
|
+
experimental: {
|
|
292
|
+
serverPathFallback: false,
|
|
293
|
+
},
|
|
294
|
+
})
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
The option has no effect when `hashMode` is enabled.
|
|
298
|
+
|
|
281
299
|
## early404
|
|
282
300
|
|
|
283
301
|
Responds with an early 404 error for requests whose path cannot match any page route, without loading the Vue app, its plugins or middleware on the server.
|
package/4.api/6.nuxt-config.md
CHANGED
|
@@ -116,13 +116,11 @@ NUXT_APP_BASE_URL=./ npm run generate
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
```ts
|
|
119
|
-
// Option 2:
|
|
119
|
+
// Option 2: Runtime config
|
|
120
120
|
export default defineNuxtConfig({
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
baseURL: './',
|
|
125
|
-
},
|
|
121
|
+
runtimeConfig: {
|
|
122
|
+
app: {
|
|
123
|
+
baseURL: './',
|
|
126
124
|
},
|
|
127
125
|
},
|
|
128
126
|
})
|