@nuxt/docs 4.3.0 → 4.3.1
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/06.styling.md +1 -1
- package/1.getting-started/15.prerendering.md +8 -0
- package/2.directory-structure/1.server.md +7 -7
- package/3.guide/1.concepts/1.rendering.md +4 -0
- package/3.guide/4.modules/3.recipes-basics.md +90 -0
- package/3.guide/5.recipes/4.sessions-and-authentication.md +1 -1
- package/3.guide/6.going-further/2.hooks.md +1 -1
- package/4.api/2.composables/use-route-announcer.md +1 -1
- package/4.api/4.commands/add.md +1 -1
- package/4.api/5.kit/11.nitro.md +6 -2
- package/4.api/5.kit/4.autoimports.md +5 -1
- package/4.api/6.nuxt-config.md +38 -21
- package/5.community/6.roadmap.md +3 -3
- package/7.migration/11.server.md +1 -1
- package/package.json +1 -1
|
@@ -155,7 +155,7 @@ Nuxt uses `unhead` under the hood, and you can refer to [its full documentation]
|
|
|
155
155
|
|
|
156
156
|
If you need more advanced control, you can intercept the rendered html with a hook and modify the head programmatically.
|
|
157
157
|
|
|
158
|
-
Create a plugin in
|
|
158
|
+
Create a plugin in `~~/server/plugins/my-plugin.ts` like this:
|
|
159
159
|
|
|
160
160
|
<!-- TODO: figure out how to use twoslash to inject types for a different context -->
|
|
161
161
|
|
|
@@ -49,6 +49,14 @@ Working of the Nitro crawler:
|
|
|
49
49
|
|
|
50
50
|
This is important to understand since pages that are not linked to a discoverable page can't be pre-rendered automatically.
|
|
51
51
|
|
|
52
|
+
### Payload Extraction
|
|
53
|
+
|
|
54
|
+
Nuxt generates `_payload.json` alongside HTML for:
|
|
55
|
+
- Prerendered routes (at build time)
|
|
56
|
+
- ISR/SWR routes (on first request)
|
|
57
|
+
|
|
58
|
+
Payloads contain serialized data from `useAsyncData` and `useFetch`. Client-side navigation loads these cached payloads instead of re-fetching data. Configure dynamic routes like `pages/[...slug].vue` with route rules: `'/**': { isr: true }`.
|
|
59
|
+
|
|
52
60
|
::read-more{to="/docs/4.x/api/commands/generate#nuxt-generate"}
|
|
53
61
|
Read more about the `nuxt generate` command.
|
|
54
62
|
::
|
|
@@ -43,11 +43,11 @@ const { data } = await useFetch('/api/hello')
|
|
|
43
43
|
|
|
44
44
|
## Server Routes
|
|
45
45
|
|
|
46
|
-
Files inside the
|
|
46
|
+
Files inside the `~~/server/api` are automatically prefixed with `/api` in their route.
|
|
47
47
|
|
|
48
48
|
:video-accordion{title="Watch a video from Vue School on API routes" videoId="761468863" platform="vimeo"}
|
|
49
49
|
|
|
50
|
-
To add server routes without `/api` prefix, put them into
|
|
50
|
+
To add server routes without `/api` prefix, put them into `~~/server/routes` directory.
|
|
51
51
|
|
|
52
52
|
**Example:**
|
|
53
53
|
|
|
@@ -63,7 +63,7 @@ Note that currently server routes do not support the full functionality of dynam
|
|
|
63
63
|
|
|
64
64
|
## Server Middleware
|
|
65
65
|
|
|
66
|
-
Nuxt will automatically read in any file in the
|
|
66
|
+
Nuxt will automatically read in any file in the `~~/server/middleware` to create server middleware for your project.
|
|
67
67
|
|
|
68
68
|
Middleware handlers will run on every request before any other server route to add or check headers, log requests, or extend the event's request object.
|
|
69
69
|
|
|
@@ -87,7 +87,7 @@ export default defineEventHandler((event) => {
|
|
|
87
87
|
|
|
88
88
|
## Server Plugins
|
|
89
89
|
|
|
90
|
-
Nuxt will automatically read any files in the
|
|
90
|
+
Nuxt will automatically read any files in the `~~/server/plugins` directory and register them as Nitro plugins. This allows extending Nitro's runtime behavior and hooking into lifecycle events.
|
|
91
91
|
|
|
92
92
|
**Example:**
|
|
93
93
|
|
|
@@ -105,7 +105,7 @@ Server routes are powered by [h3js/h3](https://github.com/h3js/h3) which comes w
|
|
|
105
105
|
|
|
106
106
|
:read-more{to="https://www.jsdocs.io/package/h3#package-index-functions" title="Available H3 Request Helpers" target="_blank"}
|
|
107
107
|
|
|
108
|
-
You can add more helpers yourself inside the
|
|
108
|
+
You can add more helpers yourself inside the `~~/server/utils` directory.
|
|
109
109
|
|
|
110
110
|
For example, you can define a custom handler utility that wraps the original handler and performs additional operations before returning the final response.
|
|
111
111
|
|
|
@@ -218,7 +218,7 @@ export default defineEventHandler((event) => {
|
|
|
218
218
|
|
|
219
219
|
Catch-all routes are helpful for fallback route handling.
|
|
220
220
|
|
|
221
|
-
For example, creating a file named
|
|
221
|
+
For example, creating a file named `~~/server/api/foo/[...].ts` will register a catch-all route for all requests that do not match any route handler, such as `/api/foo/bar/baz`.
|
|
222
222
|
|
|
223
223
|
```ts [server/api/foo/[...\\].ts]
|
|
224
224
|
export default defineEventHandler((event) => {
|
|
@@ -228,7 +228,7 @@ export default defineEventHandler((event) => {
|
|
|
228
228
|
})
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
-
You can set a name for the catch-all route by using
|
|
231
|
+
You can set a name for the catch-all route by using `~~/server/api/foo/[...slug].ts` and access it via `event.context.params.slug`.
|
|
232
232
|
|
|
233
233
|
```ts [server/api/foo/[...slug\\].ts]
|
|
234
234
|
export default defineEventHandler((event) => {
|
|
@@ -193,6 +193,10 @@ The different properties you can use are the following:
|
|
|
193
193
|
- `noScripts: boolean`{lang=ts} - Disables rendering of Nuxt scripts and JS resource hints for sections of your site.
|
|
194
194
|
- `appMiddleware: string | string[] | Record<string, boolean>`{lang=ts} - Allows you to define middleware that should or should not run for page paths within the Vue app part of your application (that is, not your Nitro routes)
|
|
195
195
|
|
|
196
|
+
::note
|
|
197
|
+
Routes using `isr` or `swr` also generate `_payload.json` files alongside HTML. Client-side navigation loads these cached payloads instead of re-fetching data. Configure dynamic routes like `pages/[...slug].vue` with glob patterns: `'/**': { isr: true }`.
|
|
198
|
+
::
|
|
199
|
+
|
|
196
200
|
Whenever possible, route rules will be automatically applied to the deployment platform's native rules for optimal performances (Netlify and Vercel are currently supported).
|
|
197
201
|
|
|
198
202
|
::important
|
|
@@ -200,6 +200,96 @@ It is highly recommended to prefix your exports to avoid conflicts with user cod
|
|
|
200
200
|
Note that all components, pages, composables and other files that would be normally placed in your `app/` folder need to be in `runtime/app/`. This will mean they can be type checked properly.
|
|
201
201
|
::
|
|
202
202
|
|
|
203
|
+
### Add Keyed Functions
|
|
204
|
+
|
|
205
|
+
Sometimes, you may need to maintain state consistency between the server and the client. Examples include Nuxt's built-in `useState` or `useAsyncData` composables. Nuxt provides a way to register such functions for automatic key injection.
|
|
206
|
+
|
|
207
|
+
When a function is registered, Nuxt’s compiler automatically injects a unique key as an additional argument if the function is called with fewer than the specified number of arguments. This key remains stable between server-side rendering and client hydration.
|
|
208
|
+
|
|
209
|
+
::tip
|
|
210
|
+
The injected key is a hash derived from the file path and call location.
|
|
211
|
+
::
|
|
212
|
+
|
|
213
|
+
Use the `keyedComposables` option to register your function:
|
|
214
|
+
|
|
215
|
+
```ts
|
|
216
|
+
import { createResolver, defineNuxtModule } from '@nuxt/kit'
|
|
217
|
+
|
|
218
|
+
export default defineNuxtModule({
|
|
219
|
+
setup (options, nuxt) {
|
|
220
|
+
const resolver = createResolver(import.meta.url)
|
|
221
|
+
|
|
222
|
+
nuxt.options.optimization.keyedComposables.push({
|
|
223
|
+
name: 'useMyState',
|
|
224
|
+
source: resolver.resolve('./runtime/composables/state'),
|
|
225
|
+
argumentLength: 2,
|
|
226
|
+
})
|
|
227
|
+
},
|
|
228
|
+
})
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The `keyedComposables` configuration accepts an array of objects with the following properties:
|
|
232
|
+
|
|
233
|
+
| Property | Type | Description |
|
|
234
|
+
|------------------|----------|----------------------------------------------------------------------------------------------------------------------------|
|
|
235
|
+
| `name` | `string` | The function name. Use `'default'` for default exports (the callable name will be derived from the filename in camelCase). |
|
|
236
|
+
| `source` | `string` | Resolved path to the file where the function is defined. Supports Nuxt aliases (`~`, `@`, etc.) |
|
|
237
|
+
| `argumentLength` | `number` | Maximum number of arguments the function accepts. When called with fewer arguments, a unique key is injected. |
|
|
238
|
+
|
|
239
|
+
For example, with `argumentLength: 2`:
|
|
240
|
+
|
|
241
|
+
```ts
|
|
242
|
+
useMyState() // useMyState('$HJiaryoL2y')
|
|
243
|
+
useMyState('myKey') // useMyState('myKey', '$HJiaryoL2y')
|
|
244
|
+
useMyState('a', 'b') // not transformed (already has 2 arguments)
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
::warning
|
|
248
|
+
The key injection plugin verifies the exact resolved import source of each function call. It does not follow barrel exports. The function must be exported from the exact source file specified in the `source` property.
|
|
249
|
+
|
|
250
|
+
```ts
|
|
251
|
+
// ✅ Works - direct import matches the configured source
|
|
252
|
+
import { useMyState } from 'my-module/runtime/composables/state'
|
|
253
|
+
|
|
254
|
+
// ❌ Won't work - re-exported through a barrel file
|
|
255
|
+
import { useMyState } from 'my-module/runtime/composables' // index.ts barrel
|
|
256
|
+
```
|
|
257
|
+
::
|
|
258
|
+
|
|
259
|
+
::warning
|
|
260
|
+
The function call must be statically analyzable. The compiler cannot inject keys for dynamic or indirect function calls.
|
|
261
|
+
|
|
262
|
+
```ts
|
|
263
|
+
import { useMyState } from 'my-module/runtime/composables/state'
|
|
264
|
+
import * as composables from 'my-module/runtime/composables/state'
|
|
265
|
+
|
|
266
|
+
// ✅ Works - direct function call
|
|
267
|
+
useMyState()
|
|
268
|
+
|
|
269
|
+
// ✅ Works - called on namespace import
|
|
270
|
+
composables.useMyState()
|
|
271
|
+
|
|
272
|
+
// ❌ Won't work - dynamic property access
|
|
273
|
+
const name = 'useMyState'
|
|
274
|
+
composables[name]()
|
|
275
|
+
|
|
276
|
+
// ❌ Won't work - reassigned to a variable
|
|
277
|
+
const myFn = useMyState
|
|
278
|
+
myFn()
|
|
279
|
+
|
|
280
|
+
// ❌ Won't work - passed as a callback
|
|
281
|
+
someFunction(useMyState)
|
|
282
|
+
|
|
283
|
+
// ❌ Won't work - destructured with renaming in a nested scope
|
|
284
|
+
function setup () {
|
|
285
|
+
const { useMyState: localState } = composables
|
|
286
|
+
localState() // not transformed
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// ...
|
|
290
|
+
```
|
|
291
|
+
::
|
|
292
|
+
|
|
203
293
|
## Add Server Routes
|
|
204
294
|
|
|
205
295
|
```ts
|
|
@@ -57,7 +57,7 @@ Explore all available App hooks.
|
|
|
57
57
|
|
|
58
58
|
These hooks are available for [server plugins](/docs/4.x/directory-structure/server#server-plugins) to hook into Nitro's runtime behavior.
|
|
59
59
|
|
|
60
|
-
```ts [
|
|
60
|
+
```ts [~~/server/plugins/test.ts]
|
|
61
61
|
export default defineNitroPlugin((nitroApp) => {
|
|
62
62
|
nitroApp.hooks.hook('render:html', (html, { event }) => {
|
|
63
63
|
console.log('render:html', html)
|
|
@@ -15,7 +15,7 @@ This composable is available in Nuxt v3.12+.
|
|
|
15
15
|
## Description
|
|
16
16
|
|
|
17
17
|
A composable which observes the page title changes and updates the announcer message accordingly. Used by [`<NuxtRouteAnnouncer>`](/docs/4.x/api/components/nuxt-route-announcer) and controllable.
|
|
18
|
-
It hooks into Unhead's
|
|
18
|
+
It hooks into Unhead's `dom:rendered` hook to read the page's title and set it as the announcer message.
|
|
19
19
|
|
|
20
20
|
## Parameters
|
|
21
21
|
|
package/4.api/4.commands/add.md
CHANGED
|
@@ -4,7 +4,7 @@ description: "Scaffold an entity into your Nuxt application."
|
|
|
4
4
|
links:
|
|
5
5
|
- label: Source
|
|
6
6
|
icon: i-simple-icons-github
|
|
7
|
-
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/add.ts
|
|
7
|
+
to: https://github.com/nuxt/cli/blob/main/packages/nuxi/src/commands/add-template.ts
|
|
8
8
|
size: xs
|
|
9
9
|
---
|
|
10
10
|
|
package/4.api/5.kit/11.nitro.md
CHANGED
|
@@ -301,6 +301,10 @@ function addPrerenderRoutes (routes: string | string[]): void
|
|
|
301
301
|
|
|
302
302
|
Add imports to the server. It makes your imports available in Nitro without the need to import them manually.
|
|
303
303
|
|
|
304
|
+
::warning
|
|
305
|
+
If you want to provide a utility that works in both server and client contexts and is usable in the [`shared/`](/docs/4.x/directory-structure/shared) directory, the function must be imported from the same source file for both [`addImports`](/docs/4.x/api/kit/autoimports#addimports) and `addServerImports` and should have identical signature. That source file should not import anything context-specific (i.e., Nitro context, Nuxt app context) or else it might cause errors during type-checking.
|
|
306
|
+
::
|
|
307
|
+
|
|
304
308
|
### Usage
|
|
305
309
|
|
|
306
310
|
```ts twoslash
|
|
@@ -422,10 +426,10 @@ export default defineEventHandler(() => {
|
|
|
422
426
|
## `addServerScanDir`
|
|
423
427
|
|
|
424
428
|
Add directories to be scanned by Nitro. It will check for subdirectories, which will be registered
|
|
425
|
-
just like the
|
|
429
|
+
just like the `~~/server` folder is.
|
|
426
430
|
|
|
427
431
|
::note
|
|
428
|
-
Only
|
|
432
|
+
Only `~~/server/api`, `~~/server/routes`, `~~/server/middleware`, and `~~/server/utils` are scanned.
|
|
429
433
|
::
|
|
430
434
|
|
|
431
435
|
### Usage
|
|
@@ -24,7 +24,11 @@ Watch Vue School video about Auto-imports Nuxt Kit utilities.
|
|
|
24
24
|
|
|
25
25
|
## `addImports`
|
|
26
26
|
|
|
27
|
-
Add imports to the Nuxt application. It makes your imports available in the Nuxt
|
|
27
|
+
Add imports to the Nuxt application. It makes your imports available in the Nuxt app context without the need to import them manually.
|
|
28
|
+
|
|
29
|
+
::tip
|
|
30
|
+
To add imports for the Nitro server context, refer to the [`addServerImports`](/docs/4.x/api/kit/nitro#addserverimports) function.
|
|
31
|
+
::
|
|
28
32
|
|
|
29
33
|
### Usage
|
|
30
34
|
|
package/4.api/6.nuxt-config.md
CHANGED
|
@@ -13,12 +13,13 @@ You can improve your DX by defining additional aliases to access custom director
|
|
|
13
13
|
- **Default**
|
|
14
14
|
```json
|
|
15
15
|
{
|
|
16
|
-
"~": "/<
|
|
17
|
-
"@": "/<
|
|
16
|
+
"~": "/<rootDir>/app",
|
|
17
|
+
"@": "/<rootDir>/app",
|
|
18
18
|
"~~": "/<rootDir>",
|
|
19
19
|
"@@": "/<rootDir>",
|
|
20
20
|
"#shared": "/<rootDir>/shared",
|
|
21
|
-
"
|
|
21
|
+
"#server": "/<rootDir>/server",
|
|
22
|
+
"assets": "/<rootDir>/app/assets",
|
|
22
23
|
"public": "/<rootDir>/public",
|
|
23
24
|
"#build": "/<rootDir>/.nuxt",
|
|
24
25
|
"#internal/nuxt/paths": "/<rootDir>/.nuxt/paths.mjs"
|
|
@@ -372,7 +373,7 @@ export default defineNuxtConfig({
|
|
|
372
373
|
build: {
|
|
373
374
|
templates: [
|
|
374
375
|
{
|
|
375
|
-
src: '
|
|
376
|
+
src: '~~/modules/support/plugin.js', // `src` can be absolute or relative
|
|
376
377
|
dst: 'support.js', // `dst` is relative to project `.nuxt` dir
|
|
377
378
|
},
|
|
378
379
|
],
|
|
@@ -880,7 +881,7 @@ Defaults to 'silent' when running in CI or when a TTY is not available. This opt
|
|
|
880
881
|
Modules are Nuxt extensions which can extend its core functionality and add endless integrations.
|
|
881
882
|
|
|
882
883
|
Each module is either a string (which can refer to a package, or be a path to a file), a tuple with the module as first string and the options as a second object, or an inline module function.
|
|
883
|
-
Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `
|
|
884
|
+
Nuxt tries to resolve each item in the modules array using node require path (in `node_modules`) and then will be resolved from project `rootDir` if `~~` alias is used.
|
|
884
885
|
|
|
885
886
|
- **Type**: `array`
|
|
886
887
|
|
|
@@ -895,8 +896,8 @@ export default defineNuxtConfig({
|
|
|
895
896
|
modules: [
|
|
896
897
|
// Using package name
|
|
897
898
|
'@nuxt/scripts',
|
|
898
|
-
// Relative to your project
|
|
899
|
-
'
|
|
899
|
+
// Relative to your project rootDir
|
|
900
|
+
'~~/custom-modules/awesome.js',
|
|
900
901
|
// Providing options
|
|
901
902
|
['@nuxtjs/google-analytics', { ua: 'X1234567' }],
|
|
902
903
|
// Inline definition
|
|
@@ -1013,8 +1014,12 @@ Options passed directly to the transformer from `unctx` that preserves async con
|
|
|
1013
1014
|
|
|
1014
1015
|
Functions to inject a key for.
|
|
1015
1016
|
|
|
1016
|
-
As long as the number of arguments passed to the function is less than `argumentLength`, an additional magic string will be injected
|
|
1017
|
-
The key
|
|
1017
|
+
As long as the number of arguments passed to the function is less than `argumentLength`, an additional magic string will be injected as the last argument. This key is stable between SSR and client-side hydration. You will need to take steps to handle this additional key.
|
|
1018
|
+
The key is unique based on the location of the function being invoked within the file.
|
|
1019
|
+
|
|
1020
|
+
::read-more{to="/docs/4.x/guide/modules/recipes-basics#add-keyed-functions"}
|
|
1021
|
+
Learn more about keyed functions.
|
|
1022
|
+
::
|
|
1018
1023
|
|
|
1019
1024
|
- **Type**: `array`
|
|
1020
1025
|
- **Default**
|
|
@@ -1022,31 +1027,38 @@ The key will be unique based on the location of the function being invoked withi
|
|
|
1022
1027
|
[
|
|
1023
1028
|
{
|
|
1024
1029
|
"name": "callOnce",
|
|
1025
|
-
"argumentLength": 3
|
|
1030
|
+
"argumentLength": 3,
|
|
1031
|
+
"source": "#app/composables/once"
|
|
1026
1032
|
},
|
|
1027
1033
|
{
|
|
1028
1034
|
"name": "defineNuxtComponent",
|
|
1029
|
-
"argumentLength": 2
|
|
1035
|
+
"argumentLength": 2,
|
|
1036
|
+
"source": "#app/composables/component"
|
|
1030
1037
|
},
|
|
1031
1038
|
{
|
|
1032
1039
|
"name": "useState",
|
|
1033
|
-
"argumentLength": 2
|
|
1040
|
+
"argumentLength": 2,
|
|
1041
|
+
"source": "#app/composables/state"
|
|
1034
1042
|
},
|
|
1035
1043
|
{
|
|
1036
1044
|
"name": "useFetch",
|
|
1037
|
-
"argumentLength": 3
|
|
1045
|
+
"argumentLength": 3,
|
|
1046
|
+
"source": "#app/composables/fetch"
|
|
1038
1047
|
},
|
|
1039
1048
|
{
|
|
1040
1049
|
"name": "useAsyncData",
|
|
1041
|
-
"argumentLength": 3
|
|
1050
|
+
"argumentLength": 3,
|
|
1051
|
+
"source": "#app/composables/asyncData"
|
|
1042
1052
|
},
|
|
1043
1053
|
{
|
|
1044
1054
|
"name": "useLazyAsyncData",
|
|
1045
|
-
"argumentLength": 3
|
|
1055
|
+
"argumentLength": 3,
|
|
1056
|
+
"source": "#app/composables/asyncData"
|
|
1046
1057
|
},
|
|
1047
1058
|
{
|
|
1048
1059
|
"name": "useLazyFetch",
|
|
1049
|
-
"argumentLength": 3
|
|
1060
|
+
"argumentLength": 3,
|
|
1061
|
+
"source": "#app/composables/fetch"
|
|
1050
1062
|
}
|
|
1051
1063
|
]
|
|
1052
1064
|
```
|
|
@@ -1297,7 +1309,7 @@ Define the server directory of your Nuxt application, where Nitro routes, middle
|
|
|
1297
1309
|
If a relative path is specified, it will be relative to your `rootDir`.
|
|
1298
1310
|
|
|
1299
1311
|
- **Type**: `string`
|
|
1300
|
-
- **Default:** `"/<
|
|
1312
|
+
- **Default:** `"/<rootDir>/server"`
|
|
1301
1313
|
|
|
1302
1314
|
## serverHandlers
|
|
1303
1315
|
|
|
@@ -1318,7 +1330,7 @@ Each handler accepts the following options:
|
|
|
1318
1330
|
```ts
|
|
1319
1331
|
export default defineNuxtConfig({
|
|
1320
1332
|
serverHandlers: [
|
|
1321
|
-
{ route: '/path/foo/**:name', handler: '
|
|
1333
|
+
{ route: '/path/foo/**:name', handler: '#server/foohandler.ts' },
|
|
1322
1334
|
],
|
|
1323
1335
|
})
|
|
1324
1336
|
```
|
|
@@ -1408,22 +1420,27 @@ export default defineNuxtConfig({
|
|
|
1408
1420
|
srcDir: 'app/',
|
|
1409
1421
|
})
|
|
1410
1422
|
```
|
|
1423
|
+
|
|
1411
1424
|
This expects the following folder structure:
|
|
1412
1425
|
```bash
|
|
1413
1426
|
-| app/
|
|
1414
1427
|
---| assets/
|
|
1415
1428
|
---| components/
|
|
1429
|
+
---| composables/
|
|
1416
1430
|
---| layouts/
|
|
1417
1431
|
---| middleware/
|
|
1418
1432
|
---| pages/
|
|
1419
1433
|
---| plugins/
|
|
1434
|
+
---| utils/
|
|
1420
1435
|
---| app.config.ts
|
|
1421
1436
|
---| app.vue
|
|
1422
1437
|
---| error.vue
|
|
1423
1438
|
-| server/
|
|
1439
|
+
-| shared/
|
|
1424
1440
|
-| public/
|
|
1425
1441
|
-| modules/
|
|
1426
|
-
-|
|
|
1442
|
+
-| layers/
|
|
1443
|
+
-| nuxt.config.ts
|
|
1427
1444
|
-| package.json
|
|
1428
1445
|
```
|
|
1429
1446
|
|
|
@@ -1692,7 +1709,7 @@ Please note that not all vite options are supported in Nuxt.
|
|
|
1692
1709
|
### `root`
|
|
1693
1710
|
|
|
1694
1711
|
- **Type**: `string`
|
|
1695
|
-
- **Default:** `"/<
|
|
1712
|
+
- **Default:** `"/<rootDir>"`
|
|
1696
1713
|
|
|
1697
1714
|
### `server`
|
|
1698
1715
|
|
|
@@ -1705,7 +1722,7 @@ Please note that not all vite options are supported in Nuxt.
|
|
|
1705
1722
|
```json
|
|
1706
1723
|
[
|
|
1707
1724
|
"/<rootDir>/.nuxt",
|
|
1708
|
-
"/<
|
|
1725
|
+
"/<rootDir>/app",
|
|
1709
1726
|
"/<rootDir>",
|
|
1710
1727
|
"/<workspaceDir>"
|
|
1711
1728
|
]
|
package/5.community/6.roadmap.md
CHANGED
|
@@ -61,15 +61,15 @@ We commit to support each major version of Nuxt for a minimum of six months afte
|
|
|
61
61
|
|
|
62
62
|
The current active version of [Nuxt](https://nuxt.com) is **v4** which is available as `nuxt` on npm with the `latest` tag.
|
|
63
63
|
|
|
64
|
-
Nuxt 3 will continue to receive maintenance updates (
|
|
64
|
+
Nuxt 3 will continue to receive maintenance updates (bug fixes and security patches) until the end of July 2026.
|
|
65
65
|
|
|
66
66
|
Each active version has its own nightly releases which are generated automatically. For more about enabling the Nuxt nightly release channel, see [the nightly release channel docs](/docs/4.x/guide/going-further/nightly-release-channel).
|
|
67
67
|
|
|
68
68
|
| Release | | Initial release | End Of Life | Docs |
|
|
69
69
|
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|----------------------------|-------------------------------------------------------------------|
|
|
70
|
-
| **5.x** (scheduled) | |
|
|
70
|
+
| **5.x** (scheduled) | | Q1 2026 (estimated) | TBA | |
|
|
71
71
|
| **4.x** (stable) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt latest version" src="https://img.shields.io/npm/v/nuxt.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2025-07-16 | 6 months after 5.x release | [nuxt.com](/docs/4.x/getting-started/introduction) |
|
|
72
|
-
| **3.x** (maintenance) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 3.x version" src="https://img.shields.io/npm/v/nuxt/3x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2022-11-16 | 2026-
|
|
72
|
+
| **3.x** (maintenance) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 3.x version" src="https://img.shields.io/npm/v/nuxt/3x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2022-11-16 | 2026-07-31 | [nuxt.com](/docs/3.x/getting-started/introduction) |
|
|
73
73
|
| **2.x** (unsupported) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 2.x version" src="https://img.shields.io/npm/v/nuxt/2x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2018-09-21 | 2024-06-30 | [v2.nuxt.com](https://v2.nuxt.com/docs/get-started/installation/) |
|
|
74
74
|
| **1.x** (unsupported) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 1.x version" src="https://img.shields.io/npm/v/nuxt/1x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2018-01-08 | 2019-09-21 | |
|
|
75
75
|
|
package/7.migration/11.server.md
CHANGED
|
@@ -10,7 +10,7 @@ In a built Nuxt 3 application, there is no runtime Nuxt dependency. That means y
|
|
|
10
10
|
## Steps
|
|
11
11
|
|
|
12
12
|
1. Remove the `render` key in your `nuxt.config`.
|
|
13
|
-
2. Any files in
|
|
13
|
+
2. Any files in `~~/server/api` and `~~/server/middleware` will be automatically registered; you can remove them from your `serverMiddleware` array.
|
|
14
14
|
3. Update any other items in your `serverMiddleware` array to point to files or npm packages directly, rather than using inline functions.
|
|
15
15
|
|
|
16
16
|
:read-more{to="/docs/4.x/directory-structure/server"}
|