@nuxt/docs 3.17.2 → 3.17.3
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/01.introduction.md +1 -1
- package/1.getting-started/02.installation.md +8 -0
- package/1.getting-started/03.configuration.md +1 -1
- package/1.getting-started/15.prerendering.md +2 -2
- package/1.getting-started/16.deployment.md +2 -2
- package/1.getting-started/18.upgrade.md +1 -3
- package/2.guide/1.concepts/3.rendering.md +2 -2
- package/2.guide/1.concepts/4.server-engine.md +1 -1
- package/2.guide/2.directory-structure/1.server.md +6 -6
- package/2.guide/3.going-further/11.nightly-release-channel.md +1 -3
- package/2.guide/3.going-further/3.modules.md +1 -1
- package/3.api/2.composables/use-request-url.md +2 -2
- package/3.api/3.utils/navigate-to.md +1 -1
- package/3.api/5.kit/11.nitro.md +1 -1
- package/3.api/5.kit/7.pages.md +2 -2
- package/3.api/6.advanced/1.hooks.md +1 -1
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ disable SSR globally with the `ssr: false` option or leverage hybrid rendering b
|
|
|
48
48
|
|
|
49
49
|
### Server engine
|
|
50
50
|
|
|
51
|
-
The Nuxt server engine [Nitro](https://nitro.
|
|
51
|
+
The Nuxt server engine [Nitro](https://nitro.build/) unlocks new full-stack capabilities.
|
|
52
52
|
|
|
53
53
|
In development, it uses Rollup and Node.js workers for your server code and context isolation. It also generates your server API by reading files in `server/api/` and server middleware from `server/middleware/`.
|
|
54
54
|
|
|
@@ -54,6 +54,10 @@ pnpm create nuxt <project-name>
|
|
|
54
54
|
bun create nuxt <project-name>
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
```bash [deno]
|
|
58
|
+
deno -A npm:create-nuxt@latest <project-name>
|
|
59
|
+
```
|
|
60
|
+
|
|
57
61
|
::
|
|
58
62
|
|
|
59
63
|
::tip
|
|
@@ -96,6 +100,10 @@ bun run dev -o
|
|
|
96
100
|
# To use the Bun runtime during development
|
|
97
101
|
# bun --bun run dev -o
|
|
98
102
|
```
|
|
103
|
+
|
|
104
|
+
```bash [deno]
|
|
105
|
+
deno run dev -o
|
|
106
|
+
```
|
|
99
107
|
::
|
|
100
108
|
|
|
101
109
|
::tip{icon="i-lucide-circle-check"}
|
|
@@ -149,7 +149,7 @@ Nuxt uses [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file a
|
|
|
149
149
|
|
|
150
150
|
Name | Config File | How To Configure
|
|
151
151
|
---------------------------------------------|---------------------------|-------------------------
|
|
152
|
-
[Nitro](https://nitro.
|
|
152
|
+
[Nitro](https://nitro.build) | ~~`nitro.config.ts`~~ | Use [`nitro`](/docs/api/nuxt-config#nitro) key in `nuxt.config`
|
|
153
153
|
[PostCSS](https://postcss.org) | ~~`postcss.config.js`~~ | Use [`postcss`](/docs/api/nuxt-config#postcss) key in `nuxt.config`
|
|
154
154
|
[Vite](https://vite.dev) | ~~`vite.config.ts`~~ | Use [`vite`](/docs/api/nuxt-config#vite) key in `nuxt.config`
|
|
155
155
|
[webpack](https://webpack.js.org) | ~~`webpack.config.ts`~~ | Use [`webpack`](/docs/api/nuxt-config#webpack-1) key in `nuxt.config`
|
|
@@ -79,7 +79,7 @@ export default defineNuxtConfig({
|
|
|
79
79
|
|
|
80
80
|
Setting `nitro.prerender` to `true` is similar to `nitro.prerender.crawlLinks` to `true`.
|
|
81
81
|
|
|
82
|
-
::read-more{to="https://nitro.
|
|
82
|
+
::read-more{to="https://nitro.build/config#prerender"}
|
|
83
83
|
Read more about pre-rendering in the Nitro documentation.
|
|
84
84
|
::
|
|
85
85
|
|
|
@@ -99,7 +99,7 @@ export default defineNuxtConfig({
|
|
|
99
99
|
});
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
::read-more{to="https://nitro.
|
|
102
|
+
::read-more{to="https://nitro.build/config/#routerules"}
|
|
103
103
|
Read more about Nitro's `routeRules` configuration.
|
|
104
104
|
::
|
|
105
105
|
|
|
@@ -62,7 +62,7 @@ By default, the workload gets distributed to the workers with the round robin st
|
|
|
62
62
|
|
|
63
63
|
### Learn More
|
|
64
64
|
|
|
65
|
-
:read-more{to="https://nitro.
|
|
65
|
+
:read-more{to="https://nitro.build/deploy/node" title="the Nitro documentation for node-server preset"}
|
|
66
66
|
|
|
67
67
|
:video-accordion{title="Watch Daniel Roe's short video on the topic" videoId="0x1H6K5yOfs"}
|
|
68
68
|
|
|
@@ -111,7 +111,7 @@ export default defineNuxtConfig({
|
|
|
111
111
|
NITRO_PRESET=node-server nuxt build
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
-
🔎 Check [the Nitro deployment](https://nitro.
|
|
114
|
+
🔎 Check [the Nitro deployment](https://nitro.build/deploy) for all possible deployment presets and providers.
|
|
115
115
|
|
|
116
116
|
## CDN Proxy
|
|
117
117
|
|
|
@@ -35,9 +35,7 @@ bun x nuxi upgrade
|
|
|
35
35
|
To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/guide/going-further/nightly-release-channel) guide.
|
|
36
36
|
|
|
37
37
|
::warning
|
|
38
|
-
The nightly release channel `latest` tag is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now
|
|
39
|
-
|
|
40
|
-
You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
|
|
38
|
+
The nightly release channel `latest` tag is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now — be careful! You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
|
|
41
39
|
::
|
|
42
40
|
|
|
43
41
|
## Testing Nuxt 4
|
|
@@ -152,7 +152,7 @@ Previously every route/page of a Nuxt application and server must use the same r
|
|
|
152
152
|
|
|
153
153
|
Nuxt includes route rules and hybrid rendering support. Using route rules you can define rules for a group of nuxt routes, change rendering mode or assign a cache strategy based on route!
|
|
154
154
|
|
|
155
|
-
Nuxt server will automatically register corresponding middleware and wrap routes with cache handlers using [Nitro caching layer](https://nitro.
|
|
155
|
+
Nuxt server will automatically register corresponding middleware and wrap routes with cache handlers using [Nitro caching layer](https://nitro.build/guide/cache).
|
|
156
156
|
|
|
157
157
|
```ts twoslash [nuxt.config.ts]
|
|
158
158
|
export default defineNuxtConfig({
|
|
@@ -219,7 +219,7 @@ With ESR, the rendering process is pushed to the 'edge' of the network - the CDN
|
|
|
219
219
|
|
|
220
220
|
When a request for a page is made, instead of going all the way to the original server, it's intercepted by the nearest edge server. This server generates the HTML for the page and sends it back to the user. This process minimizes the physical distance the data has to travel, **reducing latency and loading the page faster**.
|
|
221
221
|
|
|
222
|
-
Edge-side rendering is possible thanks to [Nitro](https://nitro.
|
|
222
|
+
Edge-side rendering is possible thanks to [Nitro](https://nitro.build/), the [server engine](/docs/guide/concepts/server-engine) that powers Nuxt. It offers cross-platform support for Node.js, Deno, Cloudflare Workers, and more.
|
|
223
223
|
|
|
224
224
|
The current platforms where you can leverage ESR are:
|
|
225
225
|
- [Cloudflare Pages](https://pages.cloudflare.com) with zero configuration using the git integration and the `nuxt build` command
|
|
@@ -3,7 +3,7 @@ title: Server Engine
|
|
|
3
3
|
description: 'Nuxt is powered by a new server engine: Nitro.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
While building Nuxt, we created a new server engine: [Nitro](https://nitro.
|
|
6
|
+
While building Nuxt, we created a new server engine: [Nitro](https://nitro.build/).
|
|
7
7
|
|
|
8
8
|
It is shipped with many features:
|
|
9
9
|
|
|
@@ -97,7 +97,7 @@ export default defineNitroPlugin((nitroApp) => {
|
|
|
97
97
|
})
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
:read-more{to="https://nitro.
|
|
100
|
+
:read-more{to="https://nitro.build/guide/plugins" title="Nitro Plugins" target="_blank"}
|
|
101
101
|
|
|
102
102
|
## Server Utilities
|
|
103
103
|
|
|
@@ -160,7 +160,7 @@ export default defineEventHandler((event) => {
|
|
|
160
160
|
})
|
|
161
161
|
```
|
|
162
162
|
|
|
163
|
-
::tip{to="https://h3.
|
|
163
|
+
::tip{to="https://h3.dev/examples/validate-data#validate-params"}
|
|
164
164
|
Alternatively, use `getValidatedRouterParams` with a schema validator such as Zod for runtime and type safety.
|
|
165
165
|
::
|
|
166
166
|
|
|
@@ -389,7 +389,7 @@ export default eventHandler((event) => {
|
|
|
389
389
|
|
|
390
390
|
### Nitro Config
|
|
391
391
|
|
|
392
|
-
You can use `nitro` key in `nuxt.config` to directly set [Nitro configuration](https://nitro.
|
|
392
|
+
You can use `nitro` key in `nuxt.config` to directly set [Nitro configuration](https://nitro.build/config).
|
|
393
393
|
|
|
394
394
|
::warning
|
|
395
395
|
This is an advanced option. Custom config can affect production deployments, as the configuration interface might change over time when Nitro is upgraded in semver-minor versions of Nuxt.
|
|
@@ -397,7 +397,7 @@ This is an advanced option. Custom config can affect production deployments, as
|
|
|
397
397
|
|
|
398
398
|
```ts [nuxt.config.ts]
|
|
399
399
|
export default defineNuxtConfig({
|
|
400
|
-
// https://nitro.
|
|
400
|
+
// https://nitro.build/config
|
|
401
401
|
nitro: {}
|
|
402
402
|
})
|
|
403
403
|
```
|
|
@@ -464,7 +464,7 @@ Never combine `next()` callback with a legacy middleware that is `async` or retu
|
|
|
464
464
|
|
|
465
465
|
### Server Storage
|
|
466
466
|
|
|
467
|
-
Nitro provides a cross-platform [storage layer](https://nitro.
|
|
467
|
+
Nitro provides a cross-platform [storage layer](https://nitro.build/guide/storage). In order to configure additional storage mount points, you can use `nitro.storage`, or [server plugins](#server-plugins).
|
|
468
468
|
|
|
469
469
|
**Example of adding a Redis storage:**
|
|
470
470
|
|
|
@@ -506,7 +506,7 @@ export default defineEventHandler(async (event) => {
|
|
|
506
506
|
})
|
|
507
507
|
```
|
|
508
508
|
|
|
509
|
-
::read-more{to="https://nitro.
|
|
509
|
+
::read-more{to="https://nitro.build/guide/storage" target="_blank"}
|
|
510
510
|
Read more about Nitro Storage Layer.
|
|
511
511
|
::
|
|
512
512
|
|
|
@@ -16,9 +16,7 @@ Features that are only available on the nightly release channel are marked with
|
|
|
16
16
|
::
|
|
17
17
|
|
|
18
18
|
::warning
|
|
19
|
-
The `latest` nightly release channel is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now
|
|
20
|
-
|
|
21
|
-
You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
|
|
19
|
+
The `latest` nightly release channel is currently tracking the Nuxt v4 branch, meaning that it is particularly likely to have breaking changes right now — be careful! You can opt in to the 3.x branch nightly releases with `"nuxt": "npm:nuxt-nightly@3x"`.
|
|
22
20
|
::
|
|
23
21
|
|
|
24
22
|
## Opting In
|
|
@@ -11,9 +11,9 @@ links:
|
|
|
11
11
|
`useRequestURL` is a helper function that returns an [URL object](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) working on both server-side and client-side.
|
|
12
12
|
|
|
13
13
|
::important
|
|
14
|
-
When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.
|
|
14
|
+
When utilizing [Hybrid Rendering](/docs/guide/concepts/rendering#hybrid-rendering) with cache strategies, all incoming request headers are dropped when handling the cached responses via the [Nitro caching layer](https://nitro.build/guide/cache) (meaning `useRequestURL` will return `localhost` for the `host`).
|
|
15
15
|
|
|
16
|
-
You can define the [`cache.varies` option](https://nitro.
|
|
16
|
+
You can define the [`cache.varies` option](https://nitro.build/guide/cache#options) to specify headers that will be considered when caching and serving the responses, such as `host` and `x-forwarded-host` for multi-tenant environments.
|
|
17
17
|
::
|
|
18
18
|
|
|
19
19
|
::code-group
|
|
@@ -17,7 +17,7 @@ Make sure to always use `await` or `return` on result of `navigateTo` when calli
|
|
|
17
17
|
::
|
|
18
18
|
|
|
19
19
|
::note
|
|
20
|
-
`navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.
|
|
20
|
+
`navigateTo` cannot be used within Nitro routes. To perform a server-side redirect in Nitro routes, use [`sendRedirect`](https://h3.dev/utils/response#sendredirectevent-location-code) instead.
|
|
21
21
|
::
|
|
22
22
|
|
|
23
23
|
### Within a Vue Component
|
package/3.api/5.kit/11.nitro.md
CHANGED
|
@@ -194,7 +194,7 @@ function useNitro (): Nitro
|
|
|
194
194
|
Add plugin to extend Nitro's runtime behavior.
|
|
195
195
|
|
|
196
196
|
::tip
|
|
197
|
-
You can read more about Nitro plugins in the [Nitro documentation](https://nitro.
|
|
197
|
+
You can read more about Nitro plugins in the [Nitro documentation](https://nitro.build/guide/plugins).
|
|
198
198
|
::
|
|
199
199
|
|
|
200
200
|
### Usage
|
package/3.api/5.kit/7.pages.md
CHANGED
|
@@ -58,10 +58,10 @@ function extendPages(callback: (pages: NuxtPage[]) => void): void
|
|
|
58
58
|
|
|
59
59
|
## `extendRouteRules`
|
|
60
60
|
|
|
61
|
-
Nuxt is powered by the [Nitro](https://nitro.
|
|
61
|
+
Nuxt is powered by the [Nitro](https://nitro.build/) server engine. With Nitro, you can incorporate high-level logic directly into your configuration, which is useful for actions like redirects, proxying, caching, and appending headers to routes. This configuration works by associating route patterns with specific route settings.
|
|
62
62
|
|
|
63
63
|
::tip
|
|
64
|
-
You can read more about Nitro route rules in the [Nitro documentation](https://nitro.
|
|
64
|
+
You can read more about Nitro route rules in the [Nitro documentation](https://nitro.build/guide/routing#route-rules).
|
|
65
65
|
::
|
|
66
66
|
|
|
67
67
|
::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/adding-route-rules-and-route-middlewares?friend=nuxt" target="_blank"}
|
|
@@ -90,7 +90,7 @@ Hook | Arguments | Description
|
|
|
90
90
|
|
|
91
91
|
## Nitro App Hooks (runtime, server-side)
|
|
92
92
|
|
|
93
|
-
See [Nitro](https://nitro.
|
|
93
|
+
See [Nitro](https://nitro.build/guide/plugins#available-hooks) for all available hooks.
|
|
94
94
|
|
|
95
95
|
Hook | Arguments | Description | Types
|
|
96
96
|
-----------------------|-----------------------|--------------------------------------|------------------
|