@nuxt/docs 4.1.2 → 4.2.0

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.
Files changed (201) hide show
  1. package/1.getting-started/01.introduction.md +6 -6
  2. package/1.getting-started/02.installation.md +3 -2
  3. package/1.getting-started/03.configuration.md +36 -36
  4. package/1.getting-started/04.views.md +9 -9
  5. package/1.getting-started/05.assets.md +15 -9
  6. package/1.getting-started/06.styling.md +58 -48
  7. package/1.getting-started/07.routing.md +17 -17
  8. package/1.getting-started/08.seo-meta.md +59 -46
  9. package/1.getting-started/09.transitions.md +49 -44
  10. package/1.getting-started/10.data-fetching.md +104 -81
  11. package/1.getting-started/11.state-management.md +26 -19
  12. package/1.getting-started/12.error-handling.md +22 -20
  13. package/1.getting-started/13.server.md +8 -8
  14. package/1.getting-started/14.layers.md +22 -16
  15. package/1.getting-started/15.prerendering.md +32 -32
  16. package/1.getting-started/16.deployment.md +10 -10
  17. package/1.getting-started/17.testing.md +44 -44
  18. package/1.getting-started/18.upgrade.md +241 -110
  19. package/2.guide/0.index.md +7 -7
  20. package/2.guide/{2.directory-structure → 1.directory-structure}/.navigation.yml +1 -1
  21. package/2.guide/{2.directory-structure → 1.directory-structure}/0.nuxt.md +3 -3
  22. package/2.guide/1.directory-structure/0.output.md +18 -0
  23. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/.navigation.yml +1 -1
  24. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.assets.md +4 -4
  25. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.components.md +45 -28
  26. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.composables.md +13 -13
  27. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.layouts.md +19 -15
  28. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.middleware.md +31 -25
  29. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.pages.md +39 -37
  30. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.plugins.md +25 -25
  31. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/1.utils.md +7 -7
  32. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app-config.md +18 -18
  33. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.app.md +7 -7
  34. package/2.guide/{2.directory-structure → 1.directory-structure}/1.app/3.error.md +6 -6
  35. package/2.guide/{2.directory-structure → 1.directory-structure}/1.content.md +7 -4
  36. package/2.guide/{2.directory-structure → 1.directory-structure}/1.modules.md +8 -8
  37. package/2.guide/{2.directory-structure → 1.directory-structure}/1.node_modules.md +2 -2
  38. package/2.guide/{2.directory-structure → 1.directory-structure}/1.public.md +2 -2
  39. package/2.guide/{2.directory-structure → 1.directory-structure}/1.server.md +35 -35
  40. package/2.guide/{2.directory-structure → 1.directory-structure}/1.shared.md +7 -7
  41. package/2.guide/{2.directory-structure → 1.directory-structure}/2.env.md +8 -8
  42. package/2.guide/{2.directory-structure → 1.directory-structure}/2.gitignore.md +1 -1
  43. package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtignore.md +5 -4
  44. package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtrc.md +4 -4
  45. package/2.guide/{2.directory-structure → 1.directory-structure}/3.nuxt-config.md +3 -3
  46. package/2.guide/{2.directory-structure → 1.directory-structure}/3.package.md +1 -1
  47. package/2.guide/{2.directory-structure → 1.directory-structure}/3.tsconfig.md +3 -3
  48. package/2.guide/{1.concepts → 2.concepts}/1.auto-imports.md +22 -22
  49. package/2.guide/{1.concepts → 2.concepts}/10.nuxt-lifecycle.md +17 -17
  50. package/2.guide/{1.concepts → 2.concepts}/2.vuejs-development.md +13 -13
  51. package/2.guide/{1.concepts → 2.concepts}/3.rendering.md +24 -22
  52. package/2.guide/{1.concepts → 2.concepts}/4.server-engine.md +6 -6
  53. package/2.guide/{1.concepts → 2.concepts}/5.modules.md +5 -5
  54. package/2.guide/{1.concepts → 2.concepts}/7.esm.md +22 -16
  55. package/2.guide/{1.concepts → 2.concepts}/8.typescript.md +12 -12
  56. package/2.guide/3.going-further/1.events.md +3 -3
  57. package/2.guide/3.going-further/1.experimental-features.md +334 -85
  58. package/2.guide/3.going-further/1.features.md +58 -11
  59. package/2.guide/3.going-further/1.internals.md +25 -25
  60. package/2.guide/3.going-further/10.runtime-config.md +12 -12
  61. package/2.guide/3.going-further/11.nightly-release-channel.md +1 -1
  62. package/2.guide/3.going-further/2.hooks.md +14 -14
  63. package/2.guide/3.going-further/3.modules.md +126 -108
  64. package/2.guide/3.going-further/4.kit.md +7 -7
  65. package/2.guide/3.going-further/6.nuxt-app.md +8 -8
  66. package/2.guide/3.going-further/7.layers.md +76 -59
  67. package/2.guide/3.going-further/9.debugging.md +2 -2
  68. package/2.guide/4.recipes/1.custom-routing.md +30 -30
  69. package/2.guide/4.recipes/2.vite-plugin.md +45 -4
  70. package/2.guide/4.recipes/3.custom-usefetch.md +13 -13
  71. package/2.guide/4.recipes/4.sessions-and-authentication.md +35 -21
  72. package/2.guide/5.best-practices/hydration.md +4 -4
  73. package/2.guide/5.best-practices/performance.md +17 -17
  74. package/3.api/1.components/1.client-only.md +6 -3
  75. package/3.api/1.components/1.nuxt-client-fallback.md +10 -7
  76. package/3.api/1.components/10.nuxt-picture.md +1 -1
  77. package/3.api/1.components/11.teleports.md +5 -2
  78. package/3.api/1.components/12.nuxt-route-announcer.md +9 -9
  79. package/3.api/1.components/13.nuxt-time.md +49 -18
  80. package/3.api/1.components/2.nuxt-page.md +6 -6
  81. package/3.api/1.components/3.nuxt-layout.md +15 -10
  82. package/3.api/1.components/4.nuxt-link.md +42 -22
  83. package/3.api/1.components/5.nuxt-loading-indicator.md +3 -3
  84. package/3.api/1.components/6.nuxt-error-boundary.md +12 -10
  85. package/3.api/2.composables/on-prehydrate.md +2 -2
  86. package/3.api/2.composables/use-app-config.md +1 -1
  87. package/3.api/2.composables/use-async-data.md +26 -22
  88. package/3.api/2.composables/use-cookie.md +29 -21
  89. package/3.api/2.composables/use-error.md +2 -2
  90. package/3.api/2.composables/use-fetch.md +62 -32
  91. package/3.api/2.composables/use-head-safe.md +7 -7
  92. package/3.api/2.composables/use-head.md +5 -5
  93. package/3.api/2.composables/use-hydration.md +6 -6
  94. package/3.api/2.composables/use-lazy-async-data.md +4 -4
  95. package/3.api/2.composables/use-lazy-fetch.md +4 -4
  96. package/3.api/2.composables/use-loading-indicator.md +12 -12
  97. package/3.api/2.composables/use-nuxt-app.md +22 -22
  98. package/3.api/2.composables/use-nuxt-data.md +8 -8
  99. package/3.api/2.composables/use-preview-mode.md +15 -18
  100. package/3.api/2.composables/use-request-event.md +1 -1
  101. package/3.api/2.composables/use-request-fetch.md +3 -3
  102. package/3.api/2.composables/use-request-header.md +1 -1
  103. package/3.api/2.composables/use-request-headers.md +4 -4
  104. package/3.api/2.composables/use-request-url.md +1 -1
  105. package/3.api/2.composables/use-response-header.md +9 -10
  106. package/3.api/2.composables/use-route-announcer.md +4 -4
  107. package/3.api/2.composables/use-route.md +1 -1
  108. package/3.api/2.composables/use-router.md +10 -8
  109. package/3.api/2.composables/use-runtime-config.md +11 -11
  110. package/3.api/2.composables/use-runtime-hook.md +2 -2
  111. package/3.api/2.composables/use-seo-meta.md +4 -4
  112. package/3.api/2.composables/use-server-seo-meta.md +6 -6
  113. package/3.api/2.composables/use-state.md +5 -5
  114. package/3.api/3.utils/$fetch.md +10 -8
  115. package/3.api/3.utils/abort-navigation.md +3 -3
  116. package/3.api/3.utils/add-route-middleware.md +5 -5
  117. package/3.api/3.utils/call-once.md +6 -6
  118. package/3.api/3.utils/clear-error.md +3 -3
  119. package/3.api/3.utils/clear-nuxt-data.md +3 -3
  120. package/3.api/3.utils/clear-nuxt-state.md +3 -3
  121. package/3.api/3.utils/create-error.md +2 -2
  122. package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
  123. package/3.api/3.utils/define-nuxt-component.md +5 -5
  124. package/3.api/3.utils/define-nuxt-plugin.md +13 -13
  125. package/3.api/3.utils/define-nuxt-route-middleware.md +5 -5
  126. package/3.api/3.utils/define-page-meta.md +23 -23
  127. package/3.api/3.utils/define-route-rules.md +7 -7
  128. package/3.api/3.utils/navigate-to.md +11 -11
  129. package/3.api/3.utils/prefetch-components.md +1 -1
  130. package/3.api/3.utils/preload-components.md +1 -1
  131. package/3.api/3.utils/preload-route-components.md +2 -2
  132. package/3.api/3.utils/prerender-routes.md +3 -3
  133. package/3.api/3.utils/refresh-cookie.md +4 -4
  134. package/3.api/3.utils/refresh-nuxt-data.md +12 -7
  135. package/3.api/3.utils/reload-nuxt-app.md +3 -3
  136. package/3.api/3.utils/set-page-layout.md +1 -1
  137. package/3.api/3.utils/set-response-status.md +3 -3
  138. package/3.api/3.utils/show-error.md +5 -5
  139. package/3.api/3.utils/update-app-config.md +4 -3
  140. package/3.api/4.commands/add.md +1 -1
  141. package/3.api/4.commands/analyze.md +2 -1
  142. package/3.api/4.commands/build.md +2 -1
  143. package/3.api/4.commands/dev.md +5 -4
  144. package/3.api/4.commands/generate.md +3 -2
  145. package/3.api/4.commands/init.md +3 -2
  146. package/3.api/4.commands/module.md +4 -4
  147. package/3.api/4.commands/prepare.md +7 -2
  148. package/3.api/4.commands/preview.md +5 -4
  149. package/3.api/4.commands/test.md +40 -0
  150. package/3.api/4.commands/typecheck.md +5 -3
  151. package/3.api/4.commands/upgrade.md +3 -3
  152. package/3.api/5.kit/1.modules.md +123 -37
  153. package/3.api/5.kit/10.runtime-config.md +1 -1
  154. package/3.api/5.kit/10.templates.md +8 -6
  155. package/3.api/5.kit/11.nitro.md +66 -62
  156. package/3.api/5.kit/12.resolving.md +2 -2
  157. package/3.api/5.kit/14.builder.md +61 -4
  158. package/3.api/5.kit/15.examples.md +5 -7
  159. package/3.api/5.kit/16.layers.md +26 -26
  160. package/3.api/5.kit/3.compatibility.md +14 -14
  161. package/3.api/5.kit/4.autoimports.md +13 -13
  162. package/3.api/5.kit/5.components.md +8 -7
  163. package/3.api/5.kit/6.context.md +3 -3
  164. package/3.api/5.kit/7.pages.md +7 -7
  165. package/3.api/5.kit/8.layout.md +2 -2
  166. package/3.api/5.kit/9.head.md +132 -0
  167. package/3.api/5.kit/9.plugins.md +5 -4
  168. package/3.api/6.advanced/1.hooks.md +5 -5
  169. package/3.api/6.advanced/2.import-meta.md +3 -3
  170. package/3.api/6.nuxt-config.md +365 -859
  171. package/3.api/index.md +7 -7
  172. package/5.community/2.getting-help.md +1 -1
  173. package/5.community/3.reporting-bugs.md +3 -3
  174. package/5.community/4.contribution.md +11 -11
  175. package/5.community/5.framework-contribution.md +4 -4
  176. package/5.community/6.roadmap.md +2 -2
  177. package/6.bridge/1.overview.md +13 -13
  178. package/6.bridge/10.configuration.md +2 -1
  179. package/6.bridge/2.typescript.md +3 -3
  180. package/6.bridge/3.bridge-composition-api.md +8 -8
  181. package/6.bridge/4.plugins-and-middleware.md +9 -9
  182. package/6.bridge/5.nuxt3-compatible-api.md +20 -17
  183. package/6.bridge/6.meta.md +20 -19
  184. package/6.bridge/7.runtime-config.md +1 -1
  185. package/6.bridge/8.nitro.md +3 -3
  186. package/6.bridge/9.vite.md +4 -4
  187. package/7.migration/1.overview.md +2 -2
  188. package/7.migration/10.bundling.md +1 -1
  189. package/7.migration/11.server.md +3 -3
  190. package/7.migration/2.configuration.md +23 -21
  191. package/7.migration/20.module-authors.md +7 -7
  192. package/7.migration/3.auto-imports.md +3 -3
  193. package/7.migration/4.meta.md +21 -18
  194. package/7.migration/5.plugins-and-middleware.md +8 -8
  195. package/7.migration/6.pages-and-layouts.md +28 -24
  196. package/7.migration/7.component-options.md +18 -18
  197. package/7.migration/8.runtime-config.md +7 -7
  198. package/package.json +1 -1
  199. package/2.guide/2.directory-structure/0.output.md +0 -18
  200. /package/2.guide/{1.concepts → 2.concepts}/.navigation.yml +0 -0
  201. /package/2.guide/{1.concepts → 2.concepts}/9.code-style.md +0 -0
@@ -5,12 +5,42 @@ description: "Enable Nuxt experimental features to unlock new possibilities."
5
5
 
6
6
  Nuxt includes experimental features that you can enable in your configuration file.
7
7
 
8
- Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You can refer to the [API documentation](/docs/api/configuration/nuxt-config#experimental) or the [source code](https://github.com/nuxt/nuxt/blob/main/packages/schema/src/config/experimental.ts) for more information.
8
+ Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You can refer to the [API documentation](/docs/4.x/api/configuration/nuxt-config#experimental) or the [source code](https://github.com/nuxt/nuxt/blob/main/packages/schema/src/config/experimental.ts) for more information.
9
9
 
10
10
  ::note
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
- *Enabled by default.*
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: true
52
- }
81
+ externalVue: false,
82
+ },
53
83
  })
54
84
  ```
55
85
 
@@ -57,72 +87,126 @@ export default defineNuxtConfig({
57
87
  This feature will likely be removed in a near future.
58
88
  ::
59
89
 
90
+ ## extractAsyncDataHandlers
91
+
92
+ Extracts handler functions from `useAsyncData` and `useLazyAsyncData` calls into separate chunks for improved code splitting and caching efficiency.
93
+
94
+ ```ts twoslash [nuxt.config.ts]
95
+ export default defineNuxtConfig({
96
+ experimental: {
97
+ extractAsyncDataHandlers: true,
98
+ },
99
+ })
100
+ ```
101
+
102
+ This feature transforms inline handler functions into dynamically imported chunks:
103
+
104
+ ```vue
105
+ <!-- Before -->
106
+ <script setup>
107
+ const { data } = await useAsyncData('user', async () => {
108
+ return await $fetch('/api/user')
109
+ })
110
+ </script>
111
+ ```
112
+
113
+ ```vue
114
+ <!-- After transformation -->
115
+ <script setup>
116
+ const { data } = await useAsyncData('user', () =>
117
+ import('/generated-chunk.js').then(r => r.default()),
118
+ )
119
+ </script>
120
+ ```
121
+
122
+ The benefit of this transformation is that we can split out data fetching logic &mdash; while still allowing the code to be loaded if required.
123
+
124
+ ::important
125
+ This feature is only recommended for **static builds** with payload extraction, and where data does not need to be re-fetched at runtime.
126
+ ::
127
+
60
128
  ## emitRouteChunkError
61
129
 
62
130
  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
131
 
64
- If you set this to `'automatic-immediate'` Nuxt will reload the current route immediately, instead of waiting for a 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/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.
132
+ 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`).
133
+
134
+ 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
135
 
66
136
  You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
67
137
 
68
138
  ```ts twoslash [nuxt.config.ts]
69
139
  export default defineNuxtConfig({
70
140
  experimental: {
71
- emitRouteChunkError: 'automatic' // or 'automatic-immediate', 'manual' or false
72
- }
141
+ emitRouteChunkError: 'automatic', // or 'automatic-immediate', 'manual' or false
142
+ },
143
+ })
144
+ ```
145
+
146
+ ## enforceModuleCompatibility
147
+
148
+ Whether Nuxt should throw an error (and fail to load) if a Nuxt module is incompatible.
149
+
150
+ This feature is disabled by default.
151
+
152
+ ```ts twoslash [nuxt.config.ts]
153
+ export default defineNuxtConfig({
154
+ experimental: {
155
+ enforceModuleCompatibility: true,
156
+ },
73
157
  })
74
158
  ```
75
159
 
76
160
  ## restoreState
77
161
 
78
- Allows Nuxt app state to be restored from `sessionStorage` when reloading the page after a chunk error or manual [`reloadNuxtApp()`](/docs/api/utils/reload-nuxt-app) call.
162
+ Allows Nuxt app state to be restored from `sessionStorage` when reloading the page after a chunk error or manual [`reloadNuxtApp()`](/docs/4.x/api/utils/reload-nuxt-app) call.
79
163
 
80
164
  To avoid hydration errors, it will be applied only after the Vue app has been mounted, meaning there may be a flicker on initial load.
81
165
 
82
166
  ::important
83
167
  Consider carefully before enabling this as it can cause unexpected behavior,
84
- and consider providing explicit keys to [`useState`](/docs/api/composables/use-state) as auto-generated keys may not match across builds.
168
+ and consider providing explicit keys to [`useState`](/docs/4.x/api/composables/use-state) as auto-generated keys may not match across builds.
85
169
  ::
86
170
 
87
171
  ```ts twoslash [nuxt.config.ts]
88
172
  export default defineNuxtConfig({
89
173
  experimental: {
90
- restoreState: true
91
- }
174
+ restoreState: true,
175
+ },
92
176
  })
93
177
  ```
94
178
 
95
179
  ## inlineRouteRules
96
180
 
97
- Define route rules at the page level using [`defineRouteRules`](/docs/api/utils/define-route-rules).
181
+ Define route rules at the page level using [`defineRouteRules`](/docs/4.x/api/utils/define-route-rules).
98
182
 
99
183
  ```ts twoslash [nuxt.config.ts]
100
184
  export default defineNuxtConfig({
101
185
  experimental: {
102
- inlineRouteRules: true
103
- }
186
+ inlineRouteRules: true,
187
+ },
104
188
  })
105
189
  ```
106
190
 
107
191
  Matching route rules will be created, based on the page's `path`.
108
192
 
109
- ::read-more{to="/docs/api/utils/define-route-rules" icon="i-lucide-square-function"}
193
+ ::read-more{to="/docs/4.x/api/utils/define-route-rules" icon="i-lucide-square-function"}
110
194
  Read more in `defineRouteRules` utility.
111
195
  ::
112
196
 
113
- :read-more{to="/docs/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
197
+ :read-more{to="/docs/4.x/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
114
198
 
115
199
  ## renderJsonPayloads
116
200
 
117
201
  Allows rendering of JSON payloads with support for revivifying complex types.
118
202
 
119
- *Enabled by default.*
203
+ This flag is enabled by default, but you can disable this feature:
120
204
 
121
205
  ```ts twoslash [nuxt.config.ts]
122
206
  export default defineNuxtConfig({
123
207
  experimental: {
124
- renderJsonPayloads: true
125
- }
208
+ renderJsonPayloads: false,
209
+ },
126
210
  })
127
211
  ```
128
212
 
@@ -133,8 +217,22 @@ Disables Vue server renderer endpoint within Nitro.
133
217
  ```ts twoslash [nuxt.config.ts]
134
218
  export default defineNuxtConfig({
135
219
  experimental: {
136
- noVueServer: true
137
- }
220
+ noVueServer: true,
221
+ },
222
+ })
223
+ ```
224
+
225
+ ## parseErrorData
226
+
227
+ Whether to parse `error.data` when rendering a server error page.
228
+
229
+ This flag is enabled by default, but you can disable this feature:
230
+
231
+ ```ts twoslash [nuxt.config.ts]
232
+ export default defineNuxtConfig({
233
+ experimental: {
234
+ parseErrorData: false,
235
+ },
138
236
  })
139
237
  ```
140
238
 
@@ -145,20 +243,20 @@ Enables extraction of payloads of pages generated with `nuxt generate`.
145
243
  ```ts twoslash [nuxt.config.ts]
146
244
  export default defineNuxtConfig({
147
245
  experimental: {
148
- payloadExtraction: true
149
- }
246
+ payloadExtraction: true,
247
+ },
150
248
  })
151
249
  ```
152
250
 
153
251
  ## clientFallback
154
252
 
155
- Enables the experimental [`<NuxtClientFallback>`](/docs/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
253
+ Enables the experimental [`<NuxtClientFallback>`](/docs/4.x/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
156
254
 
157
255
  ```ts twoslash [nuxt.config.ts]
158
256
  export default defineNuxtConfig({
159
257
  experimental: {
160
- clientFallback: true
161
- }
258
+ clientFallback: true,
259
+ },
162
260
  })
163
261
  ```
164
262
 
@@ -169,8 +267,8 @@ Enables cross-origin prefetch using the Speculation Rules API.
169
267
  ```ts twoslash [nuxt.config.ts]
170
268
  export default defineNuxtConfig({
171
269
  experimental: {
172
- crossOriginPrefetch: true
173
- }
270
+ crossOriginPrefetch: true,
271
+ },
174
272
  })
175
273
  ```
176
274
 
@@ -185,8 +283,8 @@ Enables View Transition API integration with client-side router.
185
283
  ```ts twoslash [nuxt.config.ts]
186
284
  export default defineNuxtConfig({
187
285
  experimental: {
188
- viewTransition: true
189
- }
286
+ viewTransition: true,
287
+ },
190
288
  })
191
289
  ```
192
290
 
@@ -203,24 +301,24 @@ Enables writing of early hints when using node server.
203
301
  ```ts twoslash [nuxt.config.ts]
204
302
  export default defineNuxtConfig({
205
303
  experimental: {
206
- writeEarlyHints: true
207
- }
304
+ writeEarlyHints: true,
305
+ },
208
306
  })
209
307
  ```
210
308
 
211
309
  ## componentIslands
212
310
 
213
- Enables experimental component islands support with [`<NuxtIsland>`](/docs/api/components/nuxt-island) and `.island.vue` files.
311
+ Enables experimental component islands support with [`<NuxtIsland>`](/docs/4.x/api/components/nuxt-island) and `.island.vue` files.
214
312
 
215
313
  ```ts twoslash [nuxt.config.ts]
216
314
  export default defineNuxtConfig({
217
315
  experimental: {
218
- componentIslands: true // false or 'local+remote'
219
- }
316
+ componentIslands: true, // false or 'local+remote'
317
+ },
220
318
  })
221
319
  ```
222
320
 
223
- :read-more{to="/docs/guide/directory-structure/app/components#server-components"}
321
+ :read-more{to="/docs/4.x/guide/directory-structure/app/components#server-components"}
224
322
 
225
323
  ::read-more{icon="i-simple-icons-github" to="https://github.com/nuxt/nuxt/issues/19772" target="_blank"}
226
324
  You can follow the server components roadmap on GitHub.
@@ -230,13 +328,13 @@ You can follow the server components roadmap on GitHub.
230
328
 
231
329
  Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
232
330
 
233
- *Enabled by default.*
331
+ This flag is enabled by default, but you can disable this feature:
234
332
 
235
333
  ```ts twoslash [nuxt.config.ts]
236
334
  export default defineNuxtConfig({
237
335
  experimental: {
238
- localLayerAliases: true
239
- }
336
+ localLayerAliases: false,
337
+ },
240
338
  })
241
339
  ```
242
340
 
@@ -247,12 +345,12 @@ Enable the new experimental typed router using [`unplugin-vue-router`](https://g
247
345
  ```ts twoslash [nuxt.config.ts]
248
346
  export default defineNuxtConfig({
249
347
  experimental: {
250
- typedPages: true
251
- }
348
+ typedPages: true,
349
+ },
252
350
  })
253
351
  ```
254
352
 
255
- Out of the box, this will enable typed usage of [`navigateTo`](/docs/api/utils/navigate-to), [`<NuxtLink>`](/docs/api/components/nuxt-link), [`router.push()`](/docs/api/composables/use-router) and more.
353
+ Out of the box, this will enable typed usage of [`navigateTo`](/docs/4.x/api/utils/navigate-to), [`<NuxtLink>`](/docs/4.x/api/components/nuxt-link), [`router.push()`](/docs/4.x/api/composables/use-router) and more.
256
354
 
257
355
  You can even get typed params within a page by using `const route = useRoute('route-name')`.
258
356
 
@@ -277,8 +375,8 @@ You can also set this to `chokidar` to watch all files in your source directory.
277
375
  ```ts twoslash [nuxt.config.ts]
278
376
  export default defineNuxtConfig({
279
377
  experimental: {
280
- watcher: 'chokidar-granular' // 'chokidar' or 'parcel' are also options
281
- }
378
+ watcher: 'chokidar-granular', // 'chokidar' or 'parcel' are also options
379
+ },
282
380
  })
283
381
  ```
284
382
 
@@ -291,8 +389,8 @@ You can disable this feature if needed.
291
389
  ```ts twoslash [nuxt.config.ts]
292
390
  export default defineNuxtConfig({
293
391
  experimental: {
294
- sharedPrerenderData: false
295
- }
392
+ sharedPrerenderData: false,
393
+ },
296
394
  })
297
395
  ```
298
396
 
@@ -326,7 +424,7 @@ To make globals like `Buffer` work in the browser, you need to manually inject t
326
424
  ```ts
327
425
  import { Buffer } from 'node:buffer'
328
426
 
329
- globalThis.Buffer = globalThis.Buffer || Buffer
427
+ globalThis.Buffer ||= Buffer
330
428
  ```
331
429
  ::
332
430
 
@@ -343,8 +441,8 @@ You can disable this feature if it causes issues in your project.
343
441
  ```ts twoslash [nuxt.config.ts]
344
442
  export default defineNuxtConfig({
345
443
  experimental: {
346
- scanPageMeta: false
347
- }
444
+ scanPageMeta: false,
445
+ },
348
446
  })
349
447
  ```
350
448
 
@@ -352,11 +450,13 @@ export default defineNuxtConfig({
352
450
 
353
451
  Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
354
452
 
453
+ This flag is enabled by default, but you can disable this feature:
454
+
355
455
  ```ts twoslash [nuxt.config.ts]
356
456
  export default defineNuxtConfig({
357
457
  experimental: {
358
- cookieStore: true
359
- }
458
+ cookieStore: false,
459
+ },
360
460
  })
361
461
  ```
362
462
 
@@ -368,11 +468,15 @@ Read more about the **CookieStore**.
368
468
 
369
469
  Caches Nuxt build artifacts based on a hash of the configuration and source files.
370
470
 
471
+ This only works for source files within `srcDir` and `serverDir` for the Vue/Nitro parts of your app.
472
+
473
+ This flag is disabled by default, but you can enable it:
474
+
371
475
  ```ts twoslash [nuxt.config.ts]
372
476
  export default defineNuxtConfig({
373
477
  experimental: {
374
- buildCache: true
375
- }
478
+ buildCache: true,
479
+ },
376
480
  })
377
481
  ```
378
482
 
@@ -396,6 +500,20 @@ In addition, any changes to files within `srcDir` will trigger a rebuild of the
396
500
  A maximum of 10 cache tarballs are kept.
397
501
  ::
398
502
 
503
+ ## checkOutdatedBuildInterval
504
+
505
+ Set the time interval (in ms) to check for new builds. Disabled when `experimental.appManifest` is `false`.
506
+
507
+ Set to `false` to disable.
508
+
509
+ ```ts twoslash [nuxt.config.ts]
510
+ export default defineNuxtConfig({
511
+ experimental: {
512
+ checkOutdatedBuildInterval: 3600000, // 1 hour, or false to disable
513
+ },
514
+ })
515
+ ```
516
+
399
517
  ## extraPageMetaExtractionKeys
400
518
 
401
519
  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 +523,7 @@ This option allows passing additional keys to extract from the page metadata whe
405
523
  ```vue
406
524
  <script lang="ts" setup>
407
525
  definePageMeta({
408
- foo: 'bar'
526
+ foo: 'bar',
409
527
  })
410
528
  </script>
411
529
  ```
@@ -423,7 +541,23 @@ export default defineNuxtConfig({
423
541
  })
424
542
  ```
425
543
 
426
- 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/guide/directory-structure/app/pages#typing-custom-metadata).
544
+ 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).
545
+
546
+ ## navigationRepaint
547
+
548
+ Wait for a single animation frame before navigation, which gives an opportunity for the browser to repaint, acknowledging user interaction.
549
+
550
+ It can reduce INP when navigating on prerendered routes.
551
+
552
+ This flag is enabled by default, but you can disable this feature:
553
+
554
+ ```ts twoslash [nuxt.config.ts]
555
+ export default defineNuxtConfig({
556
+ experimental: {
557
+ navigationRepaint: false,
558
+ },
559
+ })
560
+ ```
427
561
 
428
562
  ## normalizeComponentNames
429
563
 
@@ -434,8 +568,8 @@ If you encounter issues, you can disable this feature.
434
568
  ```ts twoslash [nuxt.config.ts]
435
569
  export default defineNuxtConfig({
436
570
  experimental: {
437
- normalizeComponentNames: false
438
- }
571
+ normalizeComponentNames: false,
572
+ },
439
573
  })
440
574
  ```
441
575
 
@@ -484,8 +618,8 @@ This is enabled by default in development mode. If you need to disable this feat
484
618
  ```ts twoslash [nuxt.config.ts]
485
619
  export default defineNuxtConfig({
486
620
  experimental: {
487
- browserDevtoolsTiming: false
488
- }
621
+ browserDevtoolsTiming: false,
622
+ },
489
623
  })
490
624
  ```
491
625
 
@@ -508,8 +642,8 @@ To enable it explicitly:
508
642
  ```ts twoslash [nuxt.config.ts]
509
643
  export default defineNuxtConfig({
510
644
  experimental: {
511
- debugModuleMutation: true
512
- }
645
+ debugModuleMutation: true,
646
+ },
513
647
  })
514
648
  ```
515
649
 
@@ -526,26 +660,28 @@ Lazy hydration is enabled by default, but you can disable this feature:
526
660
  ```ts twoslash [nuxt.config.ts]
527
661
  export default defineNuxtConfig({
528
662
  experimental: {
529
- lazyHydration: false
530
- }
663
+ lazyHydration: false,
664
+ },
531
665
  })
532
666
  ```
533
667
 
534
- ::read-more{icon="i-simple-icons-github" color="gray" to="/docs/guide/directory-structure/app/components#delayed-or-lazy-hydration"}
668
+ ::read-more{icon="i-simple-icons-github" color="gray" to="/docs/4.x/guide/directory-structure/app/components#delayed-or-lazy-hydration"}
535
669
  Read more about lazy hydration.
536
670
  ::
537
671
 
538
672
  ## templateImportResolution
539
673
 
540
- Controls how imports in Nuxt templates are resolved. By default, Nuxt attempts to resolve imports in templates relative to the module that added them.
674
+ Disable resolving imports into Nuxt templates from the path of the module that added the template.
541
675
 
542
- This is enabled by default, so if you're experiencing resolution conflicts in certain environments, you can disable this behavior:
676
+ 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.
677
+
678
+ This flag is enabled by default, but you can disable this feature:
543
679
 
544
680
  ```ts twoslash [nuxt.config.ts]
545
681
  export default defineNuxtConfig({
546
682
  experimental: {
547
- templateImportResolution: false
548
- }
683
+ templateImportResolution: false,
684
+ },
549
685
  })
550
686
  ```
551
687
 
@@ -553,6 +689,22 @@ export default defineNuxtConfig({
553
689
  See PR #31175 for implementation details.
554
690
  ::
555
691
 
692
+ ## templateRouteInjection
693
+
694
+ 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.
695
+
696
+ By enabling this option a mixin will be injected to keep the `$route` template object in sync with Nuxt's managed `useRoute()`.
697
+
698
+ This flag is enabled by default, but you can disable this feature:
699
+
700
+ ```ts twoslash [nuxt.config.ts]
701
+ export default defineNuxtConfig({
702
+ experimental: {
703
+ templateRouteInjection: false,
704
+ },
705
+ })
706
+ ```
707
+
556
708
  ## decorators
557
709
 
558
710
  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 +743,44 @@ const value = new SomeClass().someMethod()
591
743
  // this will return 'decorated'
592
744
  ```
593
745
 
746
+ ## defaults
747
+
748
+ This allows specifying the default options for core Nuxt components and composables.
749
+
750
+ These options will likely be moved elsewhere in the future, such as into `app.config` or into the `app/` directory.
751
+
752
+ ```ts twoslash [nuxt.config.ts]
753
+ export default defineNuxtConfig({
754
+ experimental: {
755
+ defaults: {
756
+ nuxtLink: {
757
+ componentName: 'NuxtLink',
758
+ prefetch: true,
759
+ prefetchOn: {
760
+ visibility: true,
761
+ },
762
+ },
763
+ useAsyncData: {
764
+ deep: true,
765
+ },
766
+ },
767
+ },
768
+ })
769
+ ```
770
+
594
771
  ## purgeCachedData
595
772
 
596
- Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
597
- and ensures fresh data is loaded when needed, but it is possible to disable it:
773
+ Whether to clean up Nuxt static and asyncData caches on route navigation.
774
+
775
+ 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.
776
+
777
+ This flag is enabled by default, but you can disable this feature:
598
778
 
599
779
  ```ts twoslash [nuxt.config.ts]
600
780
  export default defineNuxtConfig({
601
781
  experimental: {
602
- purgeCachedData: false
603
- }
782
+ purgeCachedData: false,
783
+ },
604
784
  })
605
785
  ```
606
786
 
@@ -612,11 +792,13 @@ See PR #31379 for implementation details.
612
792
 
613
793
  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
794
 
795
+ This flag is enabled by default, but you can disable this feature:
796
+
615
797
  ```ts twoslash [nuxt.config.ts]
616
798
  export default defineNuxtConfig({
617
799
  experimental: {
618
- granularCachedData: true
619
- }
800
+ granularCachedData: false,
801
+ },
620
802
  })
621
803
  ```
622
804
 
@@ -624,17 +806,34 @@ export default defineNuxtConfig({
624
806
  See PR #31373 for implementation details.
625
807
  ::
626
808
 
809
+ ## headNext
810
+
811
+ Use head optimisations:
812
+
813
+ - Add the capo.js head plugin in order to render tags in of the head in a more performant way.
814
+ - Uses the hash hydration plugin to reduce initial hydration
815
+
816
+ This flag is enabled by default, but you can disable this feature:
817
+
818
+ ```ts twoslash [nuxt.config.ts]
819
+ export default defineNuxtConfig({
820
+ experimental: {
821
+ headNext: false,
822
+ },
823
+ })
824
+ ```
825
+
627
826
  ## pendingWhenIdle
628
827
 
629
- If set to `false`, the `pending` object returned from `useAsyncData`, `useFetch`, `useLazyAsyncData` and `useLazyFetch` will be a computed property that is `true` only when `status` is also pending.
828
+ For `useAsyncData` and `useFetch`, whether `pending` should be `true` when data has not yet started to be fetched.
630
829
 
631
- That means that when `immediate: false` is passed, `pending` will be `false` until the first request is made.
830
+ This flag is disabled by default, but you can enable this feature:
632
831
 
633
832
  ```ts twoslash [nuxt.config.ts]
634
833
  export default defineNuxtConfig({
635
834
  experimental: {
636
- pendingWhenIdle: false
637
- }
835
+ pendingWhenIdle: true,
836
+ },
638
837
  })
639
838
  ```
640
839
 
@@ -659,14 +858,64 @@ If you need to disable this feature you can do so:
659
858
  ```ts twoslash [nuxt.config.ts]
660
859
  export default defineNuxtConfig({
661
860
  experimental: {
662
- entryImportMap: false
861
+ entryImportMap: false,
663
862
  },
664
- // or, better, simply tell vite your desired target
863
+ // or, better, simply tell vite your desired target
665
864
  // which nuxt will respect
666
865
  vite: {
667
866
  build: {
668
- target: 'safari13'
867
+ target: 'safari13',
669
868
  },
670
869
  },
671
870
  })
672
871
  ```
872
+
873
+ ## typescriptPlugin
874
+
875
+ Enable enhanced TypeScript developer experience with the `@dxup/nuxt` module.
876
+
877
+ This experimental plugin provides improved TypeScript integration and development tooling for better DX when working with TypeScript in Nuxt applications.
878
+
879
+ This flag is disabled by default, but you can enable this feature:
880
+
881
+ ```ts twoslash [nuxt.config.ts]
882
+ export default defineNuxtConfig({
883
+ experimental: {
884
+ typescriptPlugin: true,
885
+ },
886
+ })
887
+ ```
888
+
889
+ ::important
890
+ To use this feature, you need to:
891
+ - Have `typescript` installed as a dependency
892
+ - Configure VS Code to use your workspace TypeScript version (see [VS Code documentation](https://code.visualstudio.com/docs/typescript/typescript-compiling#_using-the-workspace-version-of-typescript))
893
+ ::
894
+
895
+ ::read-more{icon="i-simple-icons-github" to="https://github.com/KazariEX/dxup" target="_blank"}
896
+ Learn more about **@dxup/nuxt**.
897
+ ::
898
+
899
+ ## viteEnvironmentApi
900
+
901
+ Enable Vite 6's new [Environment API](https://vite.dev/guide/api-environment) for improved build configuration and plugin architecture.
902
+
903
+ When you set `future.compatibilityVersion` to `5`, this feature is enabled by default. You can also enable it explicitly for testing:
904
+
905
+ ```ts twoslash [nuxt.config.ts]
906
+ export default defineNuxtConfig({
907
+ experimental: {
908
+ viteEnvironmentApi: true,
909
+ },
910
+ })
911
+ ```
912
+
913
+ The Vite Environment API provides better consistency between development and production builds, more granular control over environment-specific configuration, and improved performance.
914
+
915
+ ::important
916
+ Enabling this feature changes how Vite plugins are registered and configured. See the [Vite Environment API migration guide](/docs/4.x/getting-started/upgrade#migration-to-vite-environment-api) for details on updating your plugins.
917
+ ::
918
+
919
+ ::read-more{to="https://vite.dev/guide/api-environment" target="_blank"}
920
+ Learn more about Vite's Environment API.
921
+ ::