@nuxt/docs-nightly 4.1.3-29314777.50febbbb → 4.1.3-29316225.304409da
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/03.configuration.md +19 -19
- package/1.getting-started/04.views.md +1 -1
- package/1.getting-started/05.assets.md +8 -2
- package/1.getting-started/06.styling.md +50 -40
- package/1.getting-started/07.routing.md +4 -4
- package/1.getting-started/08.seo-meta.md +46 -33
- package/1.getting-started/09.transitions.md +38 -33
- package/1.getting-started/10.data-fetching.md +47 -39
- package/1.getting-started/11.state-management.md +15 -8
- package/1.getting-started/12.error-handling.md +6 -4
- package/1.getting-started/13.server.md +3 -3
- package/1.getting-started/14.layers.md +18 -12
- package/1.getting-started/15.prerendering.md +24 -24
- package/1.getting-started/16.deployment.md +7 -7
- package/1.getting-started/17.testing.md +41 -41
- package/1.getting-started/18.upgrade.md +48 -66
- package/2.guide/1.directory-structure/1.app/1.components.md +36 -19
- package/2.guide/1.directory-structure/1.app/1.composables.md +7 -7
- package/2.guide/1.directory-structure/1.app/1.layouts.md +9 -5
- package/2.guide/1.directory-structure/1.app/1.middleware.md +20 -14
- package/2.guide/1.directory-structure/1.app/1.pages.md +19 -17
- package/2.guide/1.directory-structure/1.app/1.plugins.md +17 -17
- package/2.guide/1.directory-structure/1.app/1.utils.md +1 -1
- package/2.guide/1.directory-structure/1.app/3.app-config.md +6 -6
- package/2.guide/1.directory-structure/1.app/3.error.md +4 -4
- package/2.guide/1.directory-structure/1.content.md +4 -1
- package/2.guide/1.directory-structure/1.modules.md +4 -4
- package/2.guide/1.directory-structure/1.public.md +1 -1
- package/2.guide/1.directory-structure/1.server.md +28 -28
- package/2.guide/1.directory-structure/1.shared.md +1 -1
- package/2.guide/2.concepts/1.auto-imports.md +11 -11
- package/2.guide/2.concepts/2.vuejs-development.md +5 -5
- package/2.guide/2.concepts/3.rendering.md +14 -12
- package/2.guide/2.concepts/5.modules.md +2 -2
- package/2.guide/2.concepts/7.esm.md +14 -12
- package/2.guide/2.concepts/8.typescript.md +4 -4
- package/2.guide/3.going-further/1.events.md +2 -2
- package/2.guide/3.going-further/1.experimental-features.md +234 -73
- package/2.guide/3.going-further/1.features.md +44 -9
- package/2.guide/3.going-further/1.internals.md +15 -15
- package/2.guide/3.going-further/10.runtime-config.md +7 -7
- package/2.guide/3.going-further/2.hooks.md +8 -8
- package/2.guide/3.going-further/3.modules.md +76 -74
- package/2.guide/3.going-further/4.kit.md +3 -3
- package/2.guide/3.going-further/6.nuxt-app.md +1 -1
- package/2.guide/3.going-further/7.layers.md +50 -41
- package/2.guide/3.going-further/9.debugging.md +2 -2
- package/2.guide/4.recipes/1.custom-routing.md +19 -19
- package/2.guide/4.recipes/2.vite-plugin.md +3 -3
- package/2.guide/4.recipes/3.custom-usefetch.md +9 -9
- package/2.guide/4.recipes/4.sessions-and-authentication.md +33 -19
- package/2.guide/5.best-practices/performance.md +8 -8
- package/3.api/1.components/1.client-only.md +6 -3
- package/3.api/1.components/1.nuxt-client-fallback.md +9 -6
- package/3.api/1.components/11.teleports.md +4 -1
- package/3.api/1.components/12.nuxt-route-announcer.md +7 -7
- package/3.api/1.components/13.nuxt-time.md +44 -17
- package/3.api/1.components/2.nuxt-page.md +2 -2
- package/3.api/1.components/3.nuxt-layout.md +9 -4
- package/3.api/1.components/4.nuxt-link.md +38 -18
- package/3.api/1.components/6.nuxt-error-boundary.md +11 -9
- package/3.api/2.composables/on-prehydrate.md +2 -2
- package/3.api/2.composables/use-async-data.md +11 -11
- package/3.api/2.composables/use-cookie.md +26 -18
- package/3.api/2.composables/use-error.md +1 -1
- package/3.api/2.composables/use-fetch.md +13 -13
- package/3.api/2.composables/use-head-safe.md +5 -5
- package/3.api/2.composables/use-head.md +2 -2
- package/3.api/2.composables/use-hydration.md +5 -5
- package/3.api/2.composables/use-loading-indicator.md +10 -10
- package/3.api/2.composables/use-nuxt-app.md +9 -9
- package/3.api/2.composables/use-nuxt-data.md +7 -7
- package/3.api/2.composables/use-preview-mode.md +12 -15
- package/3.api/2.composables/use-request-fetch.md +1 -1
- package/3.api/2.composables/use-request-headers.md +3 -3
- package/3.api/2.composables/use-response-header.md +7 -8
- package/3.api/2.composables/use-route-announcer.md +3 -3
- package/3.api/2.composables/use-router.md +5 -3
- package/3.api/2.composables/use-runtime-config.md +6 -6
- package/3.api/2.composables/use-runtime-hook.md +1 -1
- package/3.api/2.composables/use-seo-meta.md +1 -1
- package/3.api/2.composables/use-server-seo-meta.md +1 -1
- package/3.api/2.composables/use-state.md +3 -3
- package/3.api/3.utils/$fetch.md +5 -3
- package/3.api/3.utils/abort-navigation.md +2 -2
- package/3.api/3.utils/add-route-middleware.md +3 -3
- package/3.api/3.utils/call-once.md +3 -3
- package/3.api/3.utils/clear-error.md +1 -1
- package/3.api/3.utils/clear-nuxt-data.md +2 -2
- package/3.api/3.utils/clear-nuxt-state.md +2 -2
- package/3.api/3.utils/create-error.md +1 -1
- package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
- package/3.api/3.utils/define-nuxt-component.md +5 -5
- package/3.api/3.utils/define-nuxt-plugin.md +11 -11
- package/3.api/3.utils/define-nuxt-route-middleware.md +2 -2
- package/3.api/3.utils/define-page-meta.md +14 -14
- package/3.api/3.utils/define-route-rules.md +3 -3
- package/3.api/3.utils/navigate-to.md +9 -9
- package/3.api/3.utils/preload-components.md +1 -1
- package/3.api/3.utils/prerender-routes.md +2 -2
- package/3.api/3.utils/refresh-cookie.md +3 -3
- package/3.api/3.utils/refresh-nuxt-data.md +9 -4
- package/3.api/3.utils/reload-nuxt-app.md +2 -2
- package/3.api/3.utils/set-response-status.md +1 -1
- package/3.api/3.utils/show-error.md +2 -2
- package/3.api/3.utils/update-app-config.md +2 -1
- package/3.api/4.commands/prepare.md +4 -0
- package/3.api/5.kit/1.modules.md +36 -36
- package/3.api/5.kit/10.templates.md +8 -6
- package/3.api/5.kit/11.nitro.md +62 -62
- package/3.api/5.kit/12.resolving.md +2 -2
- package/3.api/5.kit/14.builder.md +1 -0
- package/3.api/5.kit/15.examples.md +2 -2
- package/3.api/5.kit/16.layers.md +26 -26
- package/3.api/5.kit/3.compatibility.md +12 -12
- package/3.api/5.kit/4.autoimports.md +12 -12
- package/3.api/5.kit/5.components.md +5 -5
- package/3.api/5.kit/6.context.md +3 -3
- package/3.api/5.kit/7.pages.md +4 -4
- package/3.api/5.kit/8.layout.md +1 -1
- package/3.api/5.kit/9.plugins.md +5 -4
- package/3.api/6.advanced/2.import-meta.md +3 -3
- package/3.api/6.nuxt-config.md +293 -858
- package/6.bridge/1.overview.md +1 -1
- package/6.bridge/10.configuration.md +2 -1
- package/6.bridge/2.typescript.md +2 -2
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/4.plugins-and-middleware.md +5 -5
- package/6.bridge/5.nuxt3-compatible-api.md +11 -8
- package/6.bridge/6.meta.md +15 -14
- package/6.bridge/8.nitro.md +2 -2
- package/6.bridge/9.vite.md +3 -3
- package/7.migration/2.configuration.md +17 -15
- package/7.migration/4.meta.md +17 -14
- package/7.migration/5.plugins-and-middleware.md +5 -5
- package/7.migration/6.pages-and-layouts.md +15 -11
- package/7.migration/7.component-options.md +3 -3
- package/7.migration/8.runtime-config.md +3 -3
- package/package.json +1 -1
|
@@ -11,6 +11,36 @@ Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You
|
|
|
11
11
|
Note that these features are experimental and could be removed or modified in the future.
|
|
12
12
|
::
|
|
13
13
|
|
|
14
|
+
## alwaysRunFetchOnKeyChange
|
|
15
|
+
|
|
16
|
+
Whether to run `useFetch` when the key changes, even if it is set to `immediate: false` and it has not been triggered yet.
|
|
17
|
+
|
|
18
|
+
`useFetch` and `useAsyncData` will always run when the key changes if `immediate: true` or if it has been already triggered.
|
|
19
|
+
|
|
20
|
+
This flag is disabled by default, but you can enable this feature:
|
|
21
|
+
|
|
22
|
+
```ts twoslash [nuxt.config.ts]
|
|
23
|
+
export default defineNuxtConfig({
|
|
24
|
+
experimental: {
|
|
25
|
+
alwaysRunFetchOnKeyChange: true,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## appManifest
|
|
31
|
+
|
|
32
|
+
Use app manifests to respect route rules on client-side.
|
|
33
|
+
|
|
34
|
+
This flag is enabled by default, but you can disable this feature:
|
|
35
|
+
|
|
36
|
+
```ts twoslash [nuxt.config.ts]
|
|
37
|
+
export default defineNuxtConfig({
|
|
38
|
+
experimental: {
|
|
39
|
+
appManifest: false,
|
|
40
|
+
},
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
14
44
|
## asyncContext
|
|
15
45
|
|
|
16
46
|
Enable native async context to be accessible for nested composables in Nuxt and in Nitro. This opens the possibility to use composables inside async composables and reduce the chance to get the `Nuxt instance is unavailable` error.
|
|
@@ -18,8 +48,8 @@ Enable native async context to be accessible for nested composables in Nuxt and
|
|
|
18
48
|
```ts twoslash [nuxt.config.ts]
|
|
19
49
|
export default defineNuxtConfig({
|
|
20
50
|
experimental: {
|
|
21
|
-
asyncContext: true
|
|
22
|
-
}
|
|
51
|
+
asyncContext: true,
|
|
52
|
+
},
|
|
23
53
|
})
|
|
24
54
|
```
|
|
25
55
|
|
|
@@ -34,8 +64,8 @@ Enables generation of an async entry point for the Vue bundle, aiding module fed
|
|
|
34
64
|
```ts twoslash [nuxt.config.ts]
|
|
35
65
|
export default defineNuxtConfig({
|
|
36
66
|
experimental: {
|
|
37
|
-
asyncEntry: true
|
|
38
|
-
}
|
|
67
|
+
asyncEntry: true,
|
|
68
|
+
},
|
|
39
69
|
})
|
|
40
70
|
```
|
|
41
71
|
|
|
@@ -43,13 +73,13 @@ export default defineNuxtConfig({
|
|
|
43
73
|
|
|
44
74
|
Externalizes `vue`, `@vue/*` and `vue-router` when building.
|
|
45
75
|
|
|
46
|
-
|
|
76
|
+
This flag is enabled by default, but you can disable this feature:
|
|
47
77
|
|
|
48
78
|
```ts twoslash [nuxt.config.ts]
|
|
49
79
|
export default defineNuxtConfig({
|
|
50
80
|
experimental: {
|
|
51
|
-
externalVue:
|
|
52
|
-
}
|
|
81
|
+
externalVue: false,
|
|
82
|
+
},
|
|
53
83
|
})
|
|
54
84
|
```
|
|
55
85
|
|
|
@@ -61,15 +91,31 @@ This feature will likely be removed in a near future.
|
|
|
61
91
|
|
|
62
92
|
Emits `app:chunkError` hook when there is an error loading vite/webpack chunks. Default behavior is to perform a reload of the new route on navigation to a new route when a chunk fails to load.
|
|
63
93
|
|
|
64
|
-
|
|
94
|
+
By default, Nuxt will also perform a reload of the new route when a chunk fails to load when navigating to a new route (`automatic`).
|
|
95
|
+
|
|
96
|
+
Setting `automatic-immediate` will lead Nuxt to perform a reload of the current route right when a chunk fails to load (instead of waiting for navigation). This is useful for chunk errors that are not triggered by navigation, e.g., when your Nuxt app fails to load a [lazy component](/docs/4.x/guide/directory-structure/app/components#dynamic-imports). A potential downside of this behavior is undesired reloads, e.g., when your app does not need the chunk that caused the error.
|
|
65
97
|
|
|
66
98
|
You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
|
|
67
99
|
|
|
68
100
|
```ts twoslash [nuxt.config.ts]
|
|
69
101
|
export default defineNuxtConfig({
|
|
70
102
|
experimental: {
|
|
71
|
-
emitRouteChunkError: 'automatic' // or 'automatic-immediate', 'manual' or false
|
|
72
|
-
}
|
|
103
|
+
emitRouteChunkError: 'automatic', // or 'automatic-immediate', 'manual' or false
|
|
104
|
+
},
|
|
105
|
+
})
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## enforceModuleCompatibility
|
|
109
|
+
|
|
110
|
+
Whether Nuxt should throw an error (and fail to load) if a Nuxt module is incompatible.
|
|
111
|
+
|
|
112
|
+
This feature is disabled by default.
|
|
113
|
+
|
|
114
|
+
```ts twoslash [nuxt.config.ts]
|
|
115
|
+
export default defineNuxtConfig({
|
|
116
|
+
experimental: {
|
|
117
|
+
enforceModuleCompatibility: true,
|
|
118
|
+
},
|
|
73
119
|
})
|
|
74
120
|
```
|
|
75
121
|
|
|
@@ -87,8 +133,8 @@ and consider providing explicit keys to [`useState`](/docs/4.x/api/composables/u
|
|
|
87
133
|
```ts twoslash [nuxt.config.ts]
|
|
88
134
|
export default defineNuxtConfig({
|
|
89
135
|
experimental: {
|
|
90
|
-
restoreState: true
|
|
91
|
-
}
|
|
136
|
+
restoreState: true,
|
|
137
|
+
},
|
|
92
138
|
})
|
|
93
139
|
```
|
|
94
140
|
|
|
@@ -99,8 +145,8 @@ Define route rules at the page level using [`defineRouteRules`](/docs/4.x/api/ut
|
|
|
99
145
|
```ts twoslash [nuxt.config.ts]
|
|
100
146
|
export default defineNuxtConfig({
|
|
101
147
|
experimental: {
|
|
102
|
-
inlineRouteRules: true
|
|
103
|
-
}
|
|
148
|
+
inlineRouteRules: true,
|
|
149
|
+
},
|
|
104
150
|
})
|
|
105
151
|
```
|
|
106
152
|
|
|
@@ -116,13 +162,13 @@ Read more in `defineRouteRules` utility.
|
|
|
116
162
|
|
|
117
163
|
Allows rendering of JSON payloads with support for revivifying complex types.
|
|
118
164
|
|
|
119
|
-
|
|
165
|
+
This flag is enabled by default, but you can disable this feature:
|
|
120
166
|
|
|
121
167
|
```ts twoslash [nuxt.config.ts]
|
|
122
168
|
export default defineNuxtConfig({
|
|
123
169
|
experimental: {
|
|
124
|
-
renderJsonPayloads:
|
|
125
|
-
}
|
|
170
|
+
renderJsonPayloads: false,
|
|
171
|
+
},
|
|
126
172
|
})
|
|
127
173
|
```
|
|
128
174
|
|
|
@@ -133,8 +179,22 @@ Disables Vue server renderer endpoint within Nitro.
|
|
|
133
179
|
```ts twoslash [nuxt.config.ts]
|
|
134
180
|
export default defineNuxtConfig({
|
|
135
181
|
experimental: {
|
|
136
|
-
noVueServer: true
|
|
137
|
-
}
|
|
182
|
+
noVueServer: true,
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## parseErrorData
|
|
188
|
+
|
|
189
|
+
Whether to parse `error.data` when rendering a server error page.
|
|
190
|
+
|
|
191
|
+
This flag is enabled by default, but you can disable this feature:
|
|
192
|
+
|
|
193
|
+
```ts twoslash [nuxt.config.ts]
|
|
194
|
+
export default defineNuxtConfig({
|
|
195
|
+
experimental: {
|
|
196
|
+
parseErrorData: false,
|
|
197
|
+
},
|
|
138
198
|
})
|
|
139
199
|
```
|
|
140
200
|
|
|
@@ -145,8 +205,8 @@ Enables extraction of payloads of pages generated with `nuxt generate`.
|
|
|
145
205
|
```ts twoslash [nuxt.config.ts]
|
|
146
206
|
export default defineNuxtConfig({
|
|
147
207
|
experimental: {
|
|
148
|
-
payloadExtraction: true
|
|
149
|
-
}
|
|
208
|
+
payloadExtraction: true,
|
|
209
|
+
},
|
|
150
210
|
})
|
|
151
211
|
```
|
|
152
212
|
|
|
@@ -157,8 +217,8 @@ Enables the experimental [`<NuxtClientFallback>`](/docs/4.x/api/components/nuxt-
|
|
|
157
217
|
```ts twoslash [nuxt.config.ts]
|
|
158
218
|
export default defineNuxtConfig({
|
|
159
219
|
experimental: {
|
|
160
|
-
clientFallback: true
|
|
161
|
-
}
|
|
220
|
+
clientFallback: true,
|
|
221
|
+
},
|
|
162
222
|
})
|
|
163
223
|
```
|
|
164
224
|
|
|
@@ -169,8 +229,8 @@ Enables cross-origin prefetch using the Speculation Rules API.
|
|
|
169
229
|
```ts twoslash [nuxt.config.ts]
|
|
170
230
|
export default defineNuxtConfig({
|
|
171
231
|
experimental: {
|
|
172
|
-
crossOriginPrefetch: true
|
|
173
|
-
}
|
|
232
|
+
crossOriginPrefetch: true,
|
|
233
|
+
},
|
|
174
234
|
})
|
|
175
235
|
```
|
|
176
236
|
|
|
@@ -185,8 +245,8 @@ Enables View Transition API integration with client-side router.
|
|
|
185
245
|
```ts twoslash [nuxt.config.ts]
|
|
186
246
|
export default defineNuxtConfig({
|
|
187
247
|
experimental: {
|
|
188
|
-
viewTransition: true
|
|
189
|
-
}
|
|
248
|
+
viewTransition: true,
|
|
249
|
+
},
|
|
190
250
|
})
|
|
191
251
|
```
|
|
192
252
|
|
|
@@ -203,8 +263,8 @@ Enables writing of early hints when using node server.
|
|
|
203
263
|
```ts twoslash [nuxt.config.ts]
|
|
204
264
|
export default defineNuxtConfig({
|
|
205
265
|
experimental: {
|
|
206
|
-
writeEarlyHints: true
|
|
207
|
-
}
|
|
266
|
+
writeEarlyHints: true,
|
|
267
|
+
},
|
|
208
268
|
})
|
|
209
269
|
```
|
|
210
270
|
|
|
@@ -215,8 +275,8 @@ Enables experimental component islands support with [`<NuxtIsland>`](/docs/4.x/a
|
|
|
215
275
|
```ts twoslash [nuxt.config.ts]
|
|
216
276
|
export default defineNuxtConfig({
|
|
217
277
|
experimental: {
|
|
218
|
-
componentIslands: true // false or 'local+remote'
|
|
219
|
-
}
|
|
278
|
+
componentIslands: true, // false or 'local+remote'
|
|
279
|
+
},
|
|
220
280
|
})
|
|
221
281
|
```
|
|
222
282
|
|
|
@@ -230,13 +290,13 @@ You can follow the server components roadmap on GitHub.
|
|
|
230
290
|
|
|
231
291
|
Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
|
|
232
292
|
|
|
233
|
-
|
|
293
|
+
This flag is enabled by default, but you can disable this feature:
|
|
234
294
|
|
|
235
295
|
```ts twoslash [nuxt.config.ts]
|
|
236
296
|
export default defineNuxtConfig({
|
|
237
297
|
experimental: {
|
|
238
|
-
localLayerAliases:
|
|
239
|
-
}
|
|
298
|
+
localLayerAliases: false,
|
|
299
|
+
},
|
|
240
300
|
})
|
|
241
301
|
```
|
|
242
302
|
|
|
@@ -247,8 +307,8 @@ Enable the new experimental typed router using [`unplugin-vue-router`](https://g
|
|
|
247
307
|
```ts twoslash [nuxt.config.ts]
|
|
248
308
|
export default defineNuxtConfig({
|
|
249
309
|
experimental: {
|
|
250
|
-
typedPages: true
|
|
251
|
-
}
|
|
310
|
+
typedPages: true,
|
|
311
|
+
},
|
|
252
312
|
})
|
|
253
313
|
```
|
|
254
314
|
|
|
@@ -277,8 +337,8 @@ You can also set this to `chokidar` to watch all files in your source directory.
|
|
|
277
337
|
```ts twoslash [nuxt.config.ts]
|
|
278
338
|
export default defineNuxtConfig({
|
|
279
339
|
experimental: {
|
|
280
|
-
watcher: 'chokidar-granular' // 'chokidar' or 'parcel' are also options
|
|
281
|
-
}
|
|
340
|
+
watcher: 'chokidar-granular', // 'chokidar' or 'parcel' are also options
|
|
341
|
+
},
|
|
282
342
|
})
|
|
283
343
|
```
|
|
284
344
|
|
|
@@ -291,8 +351,8 @@ You can disable this feature if needed.
|
|
|
291
351
|
```ts twoslash [nuxt.config.ts]
|
|
292
352
|
export default defineNuxtConfig({
|
|
293
353
|
experimental: {
|
|
294
|
-
sharedPrerenderData: false
|
|
295
|
-
}
|
|
354
|
+
sharedPrerenderData: false,
|
|
355
|
+
},
|
|
296
356
|
})
|
|
297
357
|
```
|
|
298
358
|
|
|
@@ -326,7 +386,7 @@ To make globals like `Buffer` work in the browser, you need to manually inject t
|
|
|
326
386
|
```ts
|
|
327
387
|
import { Buffer } from 'node:buffer'
|
|
328
388
|
|
|
329
|
-
globalThis.Buffer
|
|
389
|
+
globalThis.Buffer ||= Buffer
|
|
330
390
|
```
|
|
331
391
|
::
|
|
332
392
|
|
|
@@ -343,8 +403,8 @@ You can disable this feature if it causes issues in your project.
|
|
|
343
403
|
```ts twoslash [nuxt.config.ts]
|
|
344
404
|
export default defineNuxtConfig({
|
|
345
405
|
experimental: {
|
|
346
|
-
scanPageMeta: false
|
|
347
|
-
}
|
|
406
|
+
scanPageMeta: false,
|
|
407
|
+
},
|
|
348
408
|
})
|
|
349
409
|
```
|
|
350
410
|
|
|
@@ -352,11 +412,13 @@ export default defineNuxtConfig({
|
|
|
352
412
|
|
|
353
413
|
Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
|
|
354
414
|
|
|
415
|
+
This flag is enabled by default, but you can disable this feature:
|
|
416
|
+
|
|
355
417
|
```ts twoslash [nuxt.config.ts]
|
|
356
418
|
export default defineNuxtConfig({
|
|
357
419
|
experimental: {
|
|
358
|
-
cookieStore:
|
|
359
|
-
}
|
|
420
|
+
cookieStore: false,
|
|
421
|
+
},
|
|
360
422
|
})
|
|
361
423
|
```
|
|
362
424
|
|
|
@@ -368,11 +430,15 @@ Read more about the **CookieStore**.
|
|
|
368
430
|
|
|
369
431
|
Caches Nuxt build artifacts based on a hash of the configuration and source files.
|
|
370
432
|
|
|
433
|
+
This only works for source files within `srcDir` and `serverDir` for the Vue/Nitro parts of your app.
|
|
434
|
+
|
|
435
|
+
This flag is disabled by default, but you can enable it:
|
|
436
|
+
|
|
371
437
|
```ts twoslash [nuxt.config.ts]
|
|
372
438
|
export default defineNuxtConfig({
|
|
373
439
|
experimental: {
|
|
374
|
-
buildCache: true
|
|
375
|
-
}
|
|
440
|
+
buildCache: true,
|
|
441
|
+
},
|
|
376
442
|
})
|
|
377
443
|
```
|
|
378
444
|
|
|
@@ -396,6 +462,20 @@ In addition, any changes to files within `srcDir` will trigger a rebuild of the
|
|
|
396
462
|
A maximum of 10 cache tarballs are kept.
|
|
397
463
|
::
|
|
398
464
|
|
|
465
|
+
## checkOutdatedBuildInterval
|
|
466
|
+
|
|
467
|
+
Set the time interval (in ms) to check for new builds. Disabled when `experimental.appManifest` is `false`.
|
|
468
|
+
|
|
469
|
+
Set to `false` to disable.
|
|
470
|
+
|
|
471
|
+
```ts twoslash [nuxt.config.ts]
|
|
472
|
+
export default defineNuxtConfig({
|
|
473
|
+
experimental: {
|
|
474
|
+
checkOutdatedBuildInterval: 3600000, // 1 hour, or false to disable
|
|
475
|
+
},
|
|
476
|
+
})
|
|
477
|
+
```
|
|
478
|
+
|
|
399
479
|
## extraPageMetaExtractionKeys
|
|
400
480
|
|
|
401
481
|
The `definePageMeta()` macro is a useful way to collect build-time meta about pages. Nuxt itself provides a set list of supported keys which is used to power some of the internal features such as redirects, page aliases and custom paths.
|
|
@@ -405,7 +485,7 @@ This option allows passing additional keys to extract from the page metadata whe
|
|
|
405
485
|
```vue
|
|
406
486
|
<script lang="ts" setup>
|
|
407
487
|
definePageMeta({
|
|
408
|
-
foo: 'bar'
|
|
488
|
+
foo: 'bar',
|
|
409
489
|
})
|
|
410
490
|
</script>
|
|
411
491
|
```
|
|
@@ -425,6 +505,22 @@ export default defineNuxtConfig({
|
|
|
425
505
|
|
|
426
506
|
This allows modules to access additional metadata from the page metadata in the build context. If you are using this within a module, it's recommended also to [augment the `NuxtPage` types with your keys](/docs/4.x/guide/directory-structure/app/pages#typing-custom-metadata).
|
|
427
507
|
|
|
508
|
+
## navigationRepaint
|
|
509
|
+
|
|
510
|
+
Wait for a single animation frame before navigation, which gives an opportunity for the browser to repaint, acknowledging user interaction.
|
|
511
|
+
|
|
512
|
+
It can reduce INP when navigating on prerendered routes.
|
|
513
|
+
|
|
514
|
+
This flag is enabled by default, but you can disable this feature:
|
|
515
|
+
|
|
516
|
+
```ts twoslash [nuxt.config.ts]
|
|
517
|
+
export default defineNuxtConfig({
|
|
518
|
+
experimental: {
|
|
519
|
+
navigationRepaint: false,
|
|
520
|
+
},
|
|
521
|
+
})
|
|
522
|
+
```
|
|
523
|
+
|
|
428
524
|
## normalizeComponentNames
|
|
429
525
|
|
|
430
526
|
Nuxt updates auto-generated Vue component names to match the full component name you would use to auto-import the component.
|
|
@@ -434,8 +530,8 @@ If you encounter issues, you can disable this feature.
|
|
|
434
530
|
```ts twoslash [nuxt.config.ts]
|
|
435
531
|
export default defineNuxtConfig({
|
|
436
532
|
experimental: {
|
|
437
|
-
normalizeComponentNames: false
|
|
438
|
-
}
|
|
533
|
+
normalizeComponentNames: false,
|
|
534
|
+
},
|
|
439
535
|
})
|
|
440
536
|
```
|
|
441
537
|
|
|
@@ -484,8 +580,8 @@ This is enabled by default in development mode. If you need to disable this feat
|
|
|
484
580
|
```ts twoslash [nuxt.config.ts]
|
|
485
581
|
export default defineNuxtConfig({
|
|
486
582
|
experimental: {
|
|
487
|
-
browserDevtoolsTiming: false
|
|
488
|
-
}
|
|
583
|
+
browserDevtoolsTiming: false,
|
|
584
|
+
},
|
|
489
585
|
})
|
|
490
586
|
```
|
|
491
587
|
|
|
@@ -508,8 +604,8 @@ To enable it explicitly:
|
|
|
508
604
|
```ts twoslash [nuxt.config.ts]
|
|
509
605
|
export default defineNuxtConfig({
|
|
510
606
|
experimental: {
|
|
511
|
-
debugModuleMutation: true
|
|
512
|
-
}
|
|
607
|
+
debugModuleMutation: true,
|
|
608
|
+
},
|
|
513
609
|
})
|
|
514
610
|
```
|
|
515
611
|
|
|
@@ -526,8 +622,8 @@ Lazy hydration is enabled by default, but you can disable this feature:
|
|
|
526
622
|
```ts twoslash [nuxt.config.ts]
|
|
527
623
|
export default defineNuxtConfig({
|
|
528
624
|
experimental: {
|
|
529
|
-
lazyHydration: false
|
|
530
|
-
}
|
|
625
|
+
lazyHydration: false,
|
|
626
|
+
},
|
|
531
627
|
})
|
|
532
628
|
```
|
|
533
629
|
|
|
@@ -537,15 +633,17 @@ Read more about lazy hydration.
|
|
|
537
633
|
|
|
538
634
|
## templateImportResolution
|
|
539
635
|
|
|
540
|
-
|
|
636
|
+
Disable resolving imports into Nuxt templates from the path of the module that added the template.
|
|
541
637
|
|
|
542
|
-
|
|
638
|
+
By default, Nuxt attempts to resolve imports in templates relative to the module that added them. Setting this to `false` disables this behavior, which may be useful if you're experiencing resolution conflicts in certain environments.
|
|
639
|
+
|
|
640
|
+
This flag is enabled by default, but you can disable this feature:
|
|
543
641
|
|
|
544
642
|
```ts twoslash [nuxt.config.ts]
|
|
545
643
|
export default defineNuxtConfig({
|
|
546
644
|
experimental: {
|
|
547
|
-
templateImportResolution: false
|
|
548
|
-
}
|
|
645
|
+
templateImportResolution: false,
|
|
646
|
+
},
|
|
549
647
|
})
|
|
550
648
|
```
|
|
551
649
|
|
|
@@ -553,6 +651,22 @@ export default defineNuxtConfig({
|
|
|
553
651
|
See PR #31175 for implementation details.
|
|
554
652
|
::
|
|
555
653
|
|
|
654
|
+
## templateRouteInjection
|
|
655
|
+
|
|
656
|
+
By default the route object returned by the auto-imported `useRoute()` composable is kept in sync with the current page in view in `<NuxtPage>`. This is not true for `vue-router`'s exported `useRoute` or for the default `$route` object available in your Vue templates.
|
|
657
|
+
|
|
658
|
+
By enabling this option a mixin will be injected to keep the `$route` template object in sync with Nuxt's managed `useRoute()`.
|
|
659
|
+
|
|
660
|
+
This flag is enabled by default, but you can disable this feature:
|
|
661
|
+
|
|
662
|
+
```ts twoslash [nuxt.config.ts]
|
|
663
|
+
export default defineNuxtConfig({
|
|
664
|
+
experimental: {
|
|
665
|
+
templateRouteInjection: false,
|
|
666
|
+
},
|
|
667
|
+
})
|
|
668
|
+
```
|
|
669
|
+
|
|
556
670
|
## decorators
|
|
557
671
|
|
|
558
672
|
This option enables enabling decorator syntax across your entire Nuxt/Nitro app, powered by [esbuild](https://github.com/evanw/esbuild/releases/tag/v0.21.3).
|
|
@@ -591,16 +705,44 @@ const value = new SomeClass().someMethod()
|
|
|
591
705
|
// this will return 'decorated'
|
|
592
706
|
```
|
|
593
707
|
|
|
708
|
+
## defaults
|
|
709
|
+
|
|
710
|
+
This allows specifying the default options for core Nuxt components and composables.
|
|
711
|
+
|
|
712
|
+
These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
|
|
713
|
+
|
|
714
|
+
```ts twoslash [nuxt.config.ts]
|
|
715
|
+
export default defineNuxtConfig({
|
|
716
|
+
experimental: {
|
|
717
|
+
defaults: {
|
|
718
|
+
nuxtLink: {
|
|
719
|
+
componentName: 'NuxtLink',
|
|
720
|
+
prefetch: true,
|
|
721
|
+
prefetchOn: {
|
|
722
|
+
visibility: true,
|
|
723
|
+
},
|
|
724
|
+
},
|
|
725
|
+
useAsyncData: {
|
|
726
|
+
deep: true,
|
|
727
|
+
},
|
|
728
|
+
},
|
|
729
|
+
},
|
|
730
|
+
})
|
|
731
|
+
```
|
|
732
|
+
|
|
594
733
|
## purgeCachedData
|
|
595
734
|
|
|
596
|
-
|
|
597
|
-
|
|
735
|
+
Whether to clean up Nuxt static and asyncData caches on route navigation.
|
|
736
|
+
|
|
737
|
+
Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks and ensures fresh data is loaded when needed, but it is possible to disable it.
|
|
738
|
+
|
|
739
|
+
This flag is enabled by default, but you can disable this feature:
|
|
598
740
|
|
|
599
741
|
```ts twoslash [nuxt.config.ts]
|
|
600
742
|
export default defineNuxtConfig({
|
|
601
743
|
experimental: {
|
|
602
|
-
purgeCachedData: false
|
|
603
|
-
}
|
|
744
|
+
purgeCachedData: false,
|
|
745
|
+
},
|
|
604
746
|
})
|
|
605
747
|
```
|
|
606
748
|
|
|
@@ -612,11 +754,13 @@ See PR #31379 for implementation details.
|
|
|
612
754
|
|
|
613
755
|
Whether to call and use the result from `getCachedData` when refreshing data for `useAsyncData` and `useFetch` (whether by `watch`, `refreshNuxtData()`, or a manual `refresh()` call.
|
|
614
756
|
|
|
757
|
+
This flag is enabled by default, but you can disable this feature:
|
|
758
|
+
|
|
615
759
|
```ts twoslash [nuxt.config.ts]
|
|
616
760
|
export default defineNuxtConfig({
|
|
617
761
|
experimental: {
|
|
618
|
-
granularCachedData:
|
|
619
|
-
}
|
|
762
|
+
granularCachedData: false,
|
|
763
|
+
},
|
|
620
764
|
})
|
|
621
765
|
```
|
|
622
766
|
|
|
@@ -624,17 +768,34 @@ export default defineNuxtConfig({
|
|
|
624
768
|
See PR #31373 for implementation details.
|
|
625
769
|
::
|
|
626
770
|
|
|
771
|
+
## headNext
|
|
772
|
+
|
|
773
|
+
Use head optimisations:
|
|
774
|
+
|
|
775
|
+
- Add the capo.js head plugin in order to render tags in of the head in a more performant way.
|
|
776
|
+
- Uses the hash hydration plugin to reduce initial hydration
|
|
777
|
+
|
|
778
|
+
This flag is enabled by default, but you can disable this feature:
|
|
779
|
+
|
|
780
|
+
```ts twoslash [nuxt.config.ts]
|
|
781
|
+
export default defineNuxtConfig({
|
|
782
|
+
experimental: {
|
|
783
|
+
headNext: false,
|
|
784
|
+
},
|
|
785
|
+
})
|
|
786
|
+
```
|
|
787
|
+
|
|
627
788
|
## pendingWhenIdle
|
|
628
789
|
|
|
629
|
-
|
|
790
|
+
For `useAsyncData` and `useFetch`, whether `pending` should be `true` when data has not yet started to be fetched.
|
|
630
791
|
|
|
631
|
-
|
|
792
|
+
This flag is disabled by default, but you can enable this feature:
|
|
632
793
|
|
|
633
794
|
```ts twoslash [nuxt.config.ts]
|
|
634
795
|
export default defineNuxtConfig({
|
|
635
796
|
experimental: {
|
|
636
|
-
pendingWhenIdle:
|
|
637
|
-
}
|
|
797
|
+
pendingWhenIdle: true,
|
|
798
|
+
},
|
|
638
799
|
})
|
|
639
800
|
```
|
|
640
801
|
|
|
@@ -659,13 +820,13 @@ If you need to disable this feature you can do so:
|
|
|
659
820
|
```ts twoslash [nuxt.config.ts]
|
|
660
821
|
export default defineNuxtConfig({
|
|
661
822
|
experimental: {
|
|
662
|
-
entryImportMap: false
|
|
823
|
+
entryImportMap: false,
|
|
663
824
|
},
|
|
664
|
-
// or, better, simply tell vite your desired target
|
|
825
|
+
// or, better, simply tell vite your desired target
|
|
665
826
|
// which nuxt will respect
|
|
666
827
|
vite: {
|
|
667
828
|
build: {
|
|
668
|
-
target: 'safari13'
|
|
829
|
+
target: 'safari13',
|
|
669
830
|
},
|
|
670
831
|
},
|
|
671
832
|
})
|
|
@@ -7,29 +7,51 @@ Some features of Nuxt are available on an opt-in basis, or can be disabled based
|
|
|
7
7
|
|
|
8
8
|
## `features`
|
|
9
9
|
|
|
10
|
+
### devLogs
|
|
11
|
+
|
|
12
|
+
Stream server logs to the client as you are developing. These logs can be handled in the `dev:ssr-logs` hook.
|
|
13
|
+
|
|
14
|
+
By default, this is enabled in development (when test mode is not active).
|
|
15
|
+
|
|
16
|
+
If set to `silent`, the logs will not be printed to the browser console.
|
|
17
|
+
|
|
18
|
+
```ts [nuxt.config.ts]
|
|
19
|
+
export default defineNuxtConfig({
|
|
20
|
+
features: {
|
|
21
|
+
devLogs: true,
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
10
26
|
### inlineStyles
|
|
11
27
|
|
|
12
28
|
Inlines styles when rendering HTML. This is currently available only when using Vite.
|
|
13
29
|
|
|
14
30
|
You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component.
|
|
15
31
|
|
|
32
|
+
It defaults to `(id) => id.includes('.vue')`.
|
|
33
|
+
|
|
16
34
|
```ts [nuxt.config.ts]
|
|
17
35
|
export default defineNuxtConfig({
|
|
18
36
|
features: {
|
|
19
|
-
inlineStyles: false // or a function to determine inlining
|
|
20
|
-
}
|
|
37
|
+
inlineStyles: false, // or a function to determine inlining
|
|
38
|
+
},
|
|
21
39
|
})
|
|
22
40
|
```
|
|
23
41
|
|
|
24
42
|
### noScripts
|
|
25
43
|
|
|
26
|
-
|
|
44
|
+
Turn off rendering of Nuxt scripts and JavaScript resource hints. Can also be configured granularly within `routeRules`.
|
|
45
|
+
|
|
46
|
+
You can also disable scripts more granularly within `routeRules`.
|
|
47
|
+
|
|
48
|
+
If set to 'production' or `true`, JavaScript will be disabled in production mode only. If set to 'all', JavaScript will be disabled in both development and production modes.
|
|
27
49
|
|
|
28
50
|
```ts [nuxt.config.ts]
|
|
29
51
|
export default defineNuxtConfig({
|
|
30
52
|
features: {
|
|
31
|
-
noScripts: true
|
|
32
|
-
}
|
|
53
|
+
noScripts: true, // or 'production' | 'all' | false
|
|
54
|
+
},
|
|
33
55
|
})
|
|
34
56
|
```
|
|
35
57
|
|
|
@@ -43,19 +65,32 @@ This is used for enabling early access to Nuxt features or flags.
|
|
|
43
65
|
|
|
44
66
|
It is not configurable yet in Nuxt 4, but once we begin merging breaking changes for v5, it will be possible to enable it.
|
|
45
67
|
|
|
68
|
+
### multiApp
|
|
69
|
+
|
|
70
|
+
This enables early access to the experimental multi-app support. You can follow the [tracker issue #21635](https://github.com/nuxt/nuxt/issues/21635) to see the progress of multi-app support in Nuxt.
|
|
71
|
+
|
|
72
|
+
```ts [nuxt.config.ts]
|
|
73
|
+
export default defineNuxtConfig({
|
|
74
|
+
future: {
|
|
75
|
+
multiApp: true,
|
|
76
|
+
},
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
|
|
46
80
|
### typescriptBundlerResolution
|
|
47
81
|
|
|
48
|
-
This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting
|
|
49
|
-
for frameworks like Nuxt and [Vite](https://vite.dev/guide/performance.html#reduce-resolve-operations).
|
|
82
|
+
This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting for frameworks like Nuxt and [Vite](https://vite.dev/guide/performance.html#reduce-resolve-operations).
|
|
50
83
|
|
|
51
84
|
It improves type support when using modern libraries with `exports`.
|
|
52
85
|
|
|
53
86
|
See [the original TypeScript pull request](https://github.com/microsoft/TypeScript/pull/51669).
|
|
54
87
|
|
|
88
|
+
You can set it to false to use the legacy 'Node' mode, which is the default for TypeScript.
|
|
89
|
+
|
|
55
90
|
```ts [nuxt.config.ts]
|
|
56
91
|
export default defineNuxtConfig({
|
|
57
92
|
future: {
|
|
58
|
-
typescriptBundlerResolution:
|
|
59
|
-
}
|
|
93
|
+
typescriptBundlerResolution: false,
|
|
94
|
+
},
|
|
60
95
|
})
|
|
61
96
|
```
|