@nuxt/docs 0.0.0 → 3.17.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 (224) hide show
  1. package/.navigation.yml +2 -0
  2. package/1.getting-started/.navigation.yml +3 -0
  3. package/1.getting-started/01.introduction.md +81 -0
  4. package/1.getting-started/02.installation.md +109 -0
  5. package/1.getting-started/03.configuration.md +226 -0
  6. package/1.getting-started/04.views.md +163 -0
  7. package/1.getting-started/05.assets.md +48 -0
  8. package/1.getting-started/06.styling.md +565 -0
  9. package/1.getting-started/07.routing.md +149 -0
  10. package/1.getting-started/08.seo-meta.md +360 -0
  11. package/1.getting-started/09.transitions.md +473 -0
  12. package/1.getting-started/10.data-fetching.md +795 -0
  13. package/1.getting-started/11.state-management.md +223 -0
  14. package/1.getting-started/12.error-handling.md +233 -0
  15. package/1.getting-started/13.server.md +94 -0
  16. package/1.getting-started/14.layers.md +92 -0
  17. package/1.getting-started/15.prerendering.md +194 -0
  18. package/1.getting-started/16.deployment.md +130 -0
  19. package/1.getting-started/17.testing.md +728 -0
  20. package/1.getting-started/18.upgrade.md +997 -0
  21. package/2.guide/.navigation.yml +2 -0
  22. package/2.guide/0.index.md +22 -0
  23. package/2.guide/1.concepts/.navigation.yml +3 -0
  24. package/2.guide/1.concepts/1.auto-imports.md +205 -0
  25. package/2.guide/1.concepts/10.nuxt-lifecycle.md +141 -0
  26. package/2.guide/1.concepts/2.vuejs-development.md +103 -0
  27. package/2.guide/1.concepts/3.rendering.md +255 -0
  28. package/2.guide/1.concepts/4.server-engine.md +62 -0
  29. package/2.guide/1.concepts/5.modules.md +48 -0
  30. package/2.guide/1.concepts/7.esm.md +299 -0
  31. package/2.guide/1.concepts/8.typescript.md +97 -0
  32. package/2.guide/1.concepts/9.code-style.md +22 -0
  33. package/2.guide/2.directory-structure/.navigation.yml +3 -0
  34. package/2.guide/2.directory-structure/0.nuxt.md +20 -0
  35. package/2.guide/2.directory-structure/0.output.md +18 -0
  36. package/2.guide/2.directory-structure/1.assets.md +16 -0
  37. package/2.guide/2.directory-structure/1.components.md +608 -0
  38. package/2.guide/2.directory-structure/1.composables.md +121 -0
  39. package/2.guide/2.directory-structure/1.content.md +64 -0
  40. package/2.guide/2.directory-structure/1.layouts.md +180 -0
  41. package/2.guide/2.directory-structure/1.middleware.md +209 -0
  42. package/2.guide/2.directory-structure/1.modules.md +66 -0
  43. package/2.guide/2.directory-structure/1.node_modules.md +12 -0
  44. package/2.guide/2.directory-structure/1.pages.md +440 -0
  45. package/2.guide/2.directory-structure/1.plugins.md +299 -0
  46. package/2.guide/2.directory-structure/1.public.md +27 -0
  47. package/2.guide/2.directory-structure/1.server.md +546 -0
  48. package/2.guide/2.directory-structure/1.shared.md +104 -0
  49. package/2.guide/2.directory-structure/1.utils.md +49 -0
  50. package/2.guide/2.directory-structure/2.env.md +75 -0
  51. package/2.guide/2.directory-structure/2.gitignore.md +37 -0
  52. package/2.guide/2.directory-structure/2.nuxtignore.md +36 -0
  53. package/2.guide/2.directory-structure/2.nuxtrc.md +50 -0
  54. package/2.guide/2.directory-structure/3.app-config.md +177 -0
  55. package/2.guide/2.directory-structure/3.app.md +72 -0
  56. package/2.guide/2.directory-structure/3.error.md +55 -0
  57. package/2.guide/2.directory-structure/3.nuxt-config.md +34 -0
  58. package/2.guide/2.directory-structure/3.package.md +32 -0
  59. package/2.guide/2.directory-structure/3.tsconfig.md +24 -0
  60. package/2.guide/3.going-further/.navigation.yml +3 -0
  61. package/2.guide/3.going-further/1.experimental-features.md +689 -0
  62. package/2.guide/3.going-further/1.features.md +103 -0
  63. package/2.guide/3.going-further/1.internals.md +81 -0
  64. package/2.guide/3.going-further/10.runtime-config.md +174 -0
  65. package/2.guide/3.going-further/11.nightly-release-channel.md +68 -0
  66. package/2.guide/3.going-further/2.hooks.md +98 -0
  67. package/2.guide/3.going-further/3.modules.md +811 -0
  68. package/2.guide/3.going-further/4.kit.md +51 -0
  69. package/2.guide/3.going-further/6.nuxt-app.md +64 -0
  70. package/2.guide/3.going-further/7.layers.md +227 -0
  71. package/2.guide/3.going-further/9.debugging.md +115 -0
  72. package/2.guide/3.going-further/index.md +4 -0
  73. package/2.guide/4.recipes/.navigation.yml +3 -0
  74. package/2.guide/4.recipes/1.custom-routing.md +181 -0
  75. package/2.guide/4.recipes/2.vite-plugin.md +65 -0
  76. package/2.guide/4.recipes/3.custom-usefetch.md +125 -0
  77. package/2.guide/4.recipes/4.sessions-and-authentication.md +203 -0
  78. package/3.api/.navigation.yml +3 -0
  79. package/3.api/1.components/.navigation.yml +3 -0
  80. package/3.api/1.components/1.client-only.md +76 -0
  81. package/3.api/1.components/1.dev-only.md +51 -0
  82. package/3.api/1.components/1.nuxt-client-fallback.md +80 -0
  83. package/3.api/1.components/10.nuxt-picture.md +27 -0
  84. package/3.api/1.components/11.teleports.md +40 -0
  85. package/3.api/1.components/12.nuxt-route-announcer.md +56 -0
  86. package/3.api/1.components/13.nuxt-time.md +173 -0
  87. package/3.api/1.components/2.nuxt-page.md +154 -0
  88. package/3.api/1.components/3.nuxt-layout.md +156 -0
  89. package/3.api/1.components/4.nuxt-link.md +322 -0
  90. package/3.api/1.components/5.nuxt-loading-indicator.md +50 -0
  91. package/3.api/1.components/6.nuxt-error-boundary.md +65 -0
  92. package/3.api/1.components/7.nuxt-welcome.md +25 -0
  93. package/3.api/1.components/8.nuxt-island.md +70 -0
  94. package/3.api/1.components/9.nuxt-img.md +43 -0
  95. package/3.api/2.composables/.navigation.yml +3 -0
  96. package/3.api/2.composables/on-prehydrate.md +60 -0
  97. package/3.api/2.composables/use-app-config.md +19 -0
  98. package/3.api/2.composables/use-async-data.md +212 -0
  99. package/3.api/2.composables/use-cookie.md +233 -0
  100. package/3.api/2.composables/use-error.md +32 -0
  101. package/3.api/2.composables/use-fetch.md +217 -0
  102. package/3.api/2.composables/use-head-safe.md +55 -0
  103. package/3.api/2.composables/use-head.md +69 -0
  104. package/3.api/2.composables/use-hydration.md +68 -0
  105. package/3.api/2.composables/use-lazy-async-data.md +47 -0
  106. package/3.api/2.composables/use-lazy-fetch.md +55 -0
  107. package/3.api/2.composables/use-loading-indicator.md +77 -0
  108. package/3.api/2.composables/use-nuxt-app.md +294 -0
  109. package/3.api/2.composables/use-nuxt-data.md +112 -0
  110. package/3.api/2.composables/use-preview-mode.md +118 -0
  111. package/3.api/2.composables/use-request-event.md +23 -0
  112. package/3.api/2.composables/use-request-fetch.md +52 -0
  113. package/3.api/2.composables/use-request-header.md +34 -0
  114. package/3.api/2.composables/use-request-headers.md +37 -0
  115. package/3.api/2.composables/use-request-url.md +41 -0
  116. package/3.api/2.composables/use-response-header.md +48 -0
  117. package/3.api/2.composables/use-route-announcer.md +60 -0
  118. package/3.api/2.composables/use-route.md +52 -0
  119. package/3.api/2.composables/use-router.md +92 -0
  120. package/3.api/2.composables/use-runtime-config.md +142 -0
  121. package/3.api/2.composables/use-runtime-hook.md +43 -0
  122. package/3.api/2.composables/use-seo-meta.md +80 -0
  123. package/3.api/2.composables/use-server-seo-meta.md +27 -0
  124. package/3.api/2.composables/use-state.md +48 -0
  125. package/3.api/3.utils/$fetch.md +98 -0
  126. package/3.api/3.utils/.navigation.yml +3 -0
  127. package/3.api/3.utils/abort-navigation.md +73 -0
  128. package/3.api/3.utils/add-route-middleware.md +88 -0
  129. package/3.api/3.utils/call-once.md +92 -0
  130. package/3.api/3.utils/clear-error.md +29 -0
  131. package/3.api/3.utils/clear-nuxt-data.md +23 -0
  132. package/3.api/3.utils/clear-nuxt-state.md +23 -0
  133. package/3.api/3.utils/create-error.md +55 -0
  134. package/3.api/3.utils/define-nuxt-component.md +53 -0
  135. package/3.api/3.utils/define-nuxt-route-middleware.md +67 -0
  136. package/3.api/3.utils/define-page-meta.md +234 -0
  137. package/3.api/3.utils/define-route-rules.md +52 -0
  138. package/3.api/3.utils/navigate-to.md +230 -0
  139. package/3.api/3.utils/on-before-route-leave.md +11 -0
  140. package/3.api/3.utils/on-before-route-update.md +11 -0
  141. package/3.api/3.utils/on-nuxt-ready.md +25 -0
  142. package/3.api/3.utils/prefetch-components.md +28 -0
  143. package/3.api/3.utils/preload-components.md +23 -0
  144. package/3.api/3.utils/preload-route-components.md +41 -0
  145. package/3.api/3.utils/prerender-routes.md +46 -0
  146. package/3.api/3.utils/refresh-cookie.md +46 -0
  147. package/3.api/3.utils/refresh-nuxt-data.md +91 -0
  148. package/3.api/3.utils/reload-nuxt-app.md +74 -0
  149. package/3.api/3.utils/set-page-layout.md +24 -0
  150. package/3.api/3.utils/set-response-status.md +36 -0
  151. package/3.api/3.utils/show-error.md +31 -0
  152. package/3.api/3.utils/update-app-config.md +27 -0
  153. package/3.api/4.commands/.navigation.yml +3 -0
  154. package/3.api/4.commands/add.md +112 -0
  155. package/3.api/4.commands/analyze.md +41 -0
  156. package/3.api/4.commands/build-module.md +42 -0
  157. package/3.api/4.commands/build.md +46 -0
  158. package/3.api/4.commands/cleanup.md +38 -0
  159. package/3.api/4.commands/dev.md +59 -0
  160. package/3.api/4.commands/devtools.md +38 -0
  161. package/3.api/4.commands/generate.md +41 -0
  162. package/3.api/4.commands/info.md +33 -0
  163. package/3.api/4.commands/init.md +46 -0
  164. package/3.api/4.commands/module.md +84 -0
  165. package/3.api/4.commands/prepare.md +36 -0
  166. package/3.api/4.commands/preview.md +43 -0
  167. package/3.api/4.commands/typecheck.md +42 -0
  168. package/3.api/4.commands/upgrade.md +37 -0
  169. package/3.api/5.kit/.navigation.yml +3 -0
  170. package/3.api/5.kit/1.modules.md +172 -0
  171. package/3.api/5.kit/10.runtime-config.md +27 -0
  172. package/3.api/5.kit/10.templates.md +283 -0
  173. package/3.api/5.kit/11.nitro.md +409 -0
  174. package/3.api/5.kit/12.resolving.md +268 -0
  175. package/3.api/5.kit/13.logging.md +65 -0
  176. package/3.api/5.kit/14.builder.md +491 -0
  177. package/3.api/5.kit/15.examples.md +41 -0
  178. package/3.api/5.kit/2.programmatic.md +125 -0
  179. package/3.api/5.kit/3.compatibility.md +230 -0
  180. package/3.api/5.kit/4.autoimports.md +144 -0
  181. package/3.api/5.kit/5.components.md +127 -0
  182. package/3.api/5.kit/6.context.md +130 -0
  183. package/3.api/5.kit/7.pages.md +295 -0
  184. package/3.api/5.kit/8.layout.md +80 -0
  185. package/3.api/5.kit/9.plugins.md +263 -0
  186. package/3.api/6.advanced/.navigation.yml +1 -0
  187. package/3.api/6.advanced/1.hooks.md +105 -0
  188. package/3.api/6.advanced/2.import-meta.md +60 -0
  189. package/3.api/6.nuxt-config.md +12 -0
  190. package/3.api/index.md +31 -0
  191. package/5.community/.navigation.yml +3 -0
  192. package/5.community/2.getting-help.md +48 -0
  193. package/5.community/3.reporting-bugs.md +50 -0
  194. package/5.community/4.contribution.md +205 -0
  195. package/5.community/5.framework-contribution.md +142 -0
  196. package/5.community/6.roadmap.md +79 -0
  197. package/5.community/7.changelog.md +92 -0
  198. package/6.bridge/.navigation.yml +3 -0
  199. package/6.bridge/1.overview.md +137 -0
  200. package/6.bridge/10.configuration.md +96 -0
  201. package/6.bridge/2.typescript.md +46 -0
  202. package/6.bridge/3.bridge-composition-api.md +132 -0
  203. package/6.bridge/4.plugins-and-middleware.md +65 -0
  204. package/6.bridge/5.nuxt3-compatible-api.md +204 -0
  205. package/6.bridge/6.meta.md +117 -0
  206. package/6.bridge/7.runtime-config.md +38 -0
  207. package/6.bridge/8.nitro.md +102 -0
  208. package/6.bridge/9.vite.md +37 -0
  209. package/7.migration/.navigation.yml +3 -0
  210. package/7.migration/1.overview.md +24 -0
  211. package/7.migration/10.bundling.md +28 -0
  212. package/7.migration/11.server.md +17 -0
  213. package/7.migration/2.configuration.md +240 -0
  214. package/7.migration/20.module-authors.md +94 -0
  215. package/7.migration/3.auto-imports.md +18 -0
  216. package/7.migration/4.meta.md +127 -0
  217. package/7.migration/5.plugins-and-middleware.md +80 -0
  218. package/7.migration/6.pages-and-layouts.md +233 -0
  219. package/7.migration/7.component-options.md +156 -0
  220. package/7.migration/8.runtime-config.md +58 -0
  221. package/LICENSE +21 -0
  222. package/README.md +11 -0
  223. package/package.json +16 -4
  224. package/dist/.gitkeep +0 -0
@@ -0,0 +1,689 @@
1
+ ---
2
+ title: "Experimental Features"
3
+ description: "Enable Nuxt experimental features to unlock new possibilities."
4
+ ---
5
+
6
+ The Nuxt experimental features can be enabled in the Nuxt configuration file.
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.
9
+
10
+ ::note
11
+ Note that these features are experimental and could be removed or modified in the future.
12
+ ::
13
+
14
+ ## asyncContext
15
+
16
+ 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.
17
+
18
+ ```ts twoslash [nuxt.config.ts]
19
+ export default defineNuxtConfig({
20
+ experimental: {
21
+ asyncContext: true
22
+ }
23
+ })
24
+ ```
25
+
26
+ ::read-more{icon="i-simple-icons-github" to="https://github.com/nuxt/nuxt/pull/20918" target="_blank"}
27
+ See full explanation on the GitHub pull-request.
28
+ ::
29
+
30
+ ## asyncEntry
31
+
32
+ Enables generation of an async entry point for the Vue bundle, aiding module federation support.
33
+
34
+ ```ts twoslash [nuxt.config.ts]
35
+ export default defineNuxtConfig({
36
+ experimental: {
37
+ asyncEntry: true
38
+ }
39
+ })
40
+ ```
41
+
42
+ ## externalVue
43
+
44
+ Externalizes `vue`, `@vue/*` and `vue-router` when building.
45
+
46
+ *Enabled by default.*
47
+
48
+ ```ts twoslash [nuxt.config.ts]
49
+ export default defineNuxtConfig({
50
+ experimental: {
51
+ externalVue: true
52
+ }
53
+ })
54
+ ```
55
+
56
+ ::warning
57
+ This feature will likely be removed in a near future.
58
+ ::
59
+
60
+ ## treeshakeClientOnly
61
+
62
+ Tree shakes contents of client-only components from server bundle.
63
+
64
+ *Enabled by default.*
65
+
66
+ ```ts twoslash [nuxt.config.ts]
67
+ export default defineNuxtConfig({
68
+ experimental: {
69
+ treeshakeClientOnly: true
70
+ }
71
+ })
72
+ ```
73
+
74
+ ## emitRouteChunkError
75
+
76
+ 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.
77
+
78
+ If you set this to `'automatic-immediate'` Nuxt will reload the current route immediatly, 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/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.
79
+
80
+ You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
81
+
82
+ ```ts twoslash [nuxt.config.ts]
83
+ export default defineNuxtConfig({
84
+ experimental: {
85
+ emitRouteChunkError: 'automatic' // or 'automatic-immediate', 'manual' or false
86
+ }
87
+ })
88
+ ```
89
+
90
+ ## restoreState
91
+
92
+ 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.
93
+
94
+ 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.
95
+
96
+ ::important
97
+ Consider carefully before enabling this as it can cause unexpected behavior,
98
+ and consider providing explicit keys to [`useState`](/docs/api/composables/use-state) as auto-generated keys may not match across builds.
99
+ ::
100
+
101
+ ```ts twoslash [nuxt.config.ts]
102
+ export default defineNuxtConfig({
103
+ experimental: {
104
+ restoreState: true
105
+ }
106
+ })
107
+ ```
108
+
109
+ ## inlineRouteRules
110
+
111
+ Define route rules at the page level using [`defineRouteRules`](/docs/api/utils/define-route-rules).
112
+
113
+ ```ts twoslash [nuxt.config.ts]
114
+ export default defineNuxtConfig({
115
+ experimental: {
116
+ inlineRouteRules: true
117
+ }
118
+ })
119
+ ```
120
+
121
+ Matching route rules will be created, based on the page's `path`.
122
+
123
+ ::read-more{to="/docs/api/utils/define-route-rules" icon="i-lucide-square-function"}
124
+ Read more in `defineRouteRules` utility.
125
+ ::
126
+
127
+ :read-more{to="/docs/guide/concepts/rendering#hybrid-rendering" icon="i-lucide-medal"}
128
+
129
+ ## renderJsonPayloads
130
+
131
+ Allows rendering of JSON payloads with support for revivifying complex types.
132
+
133
+ *Enabled by default.*
134
+
135
+ ```ts twoslash [nuxt.config.ts]
136
+ export default defineNuxtConfig({
137
+ experimental: {
138
+ renderJsonPayloads: true
139
+ }
140
+ })
141
+ ```
142
+
143
+ ## noVueServer
144
+
145
+ Disables Vue server renderer endpoint within Nitro.
146
+
147
+ ```ts twoslash [nuxt.config.ts]
148
+ export default defineNuxtConfig({
149
+ experimental: {
150
+ noVueServer: true
151
+ }
152
+ })
153
+ ```
154
+
155
+ ## payloadExtraction
156
+
157
+ Enables extraction of payloads of pages generated with `nuxt generate`.
158
+
159
+ ```ts twoslash [nuxt.config.ts]
160
+ export default defineNuxtConfig({
161
+ experimental: {
162
+ payloadExtraction: true
163
+ }
164
+ })
165
+ ```
166
+
167
+ ## clientFallback
168
+
169
+ Enables the experimental [`<NuxtClientFallback>`](/docs/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
170
+
171
+ ```ts twoslash [nuxt.config.ts]
172
+ export default defineNuxtConfig({
173
+ experimental: {
174
+ clientFallback: true
175
+ }
176
+ })
177
+ ```
178
+
179
+ ## crossOriginPrefetch
180
+
181
+ Enables cross-origin prefetch using the Speculation Rules API.
182
+
183
+ ```ts twoslash [nuxt.config.ts]
184
+ export default defineNuxtConfig({
185
+ experimental: {
186
+ crossOriginPrefetch: true
187
+ }
188
+ })
189
+ ```
190
+
191
+ ::read-more{icon="i-simple-icons-w3c" to="https://wicg.github.io/nav-speculation/prefetch.html" target="_blank"}
192
+ Read more about the **Speculation Rules API**.
193
+ ::
194
+
195
+ ## viewTransition
196
+
197
+ Enables View Transition API integration with client-side router.
198
+
199
+ ```ts twoslash [nuxt.config.ts]
200
+ export default defineNuxtConfig({
201
+ experimental: {
202
+ viewTransition: true
203
+ }
204
+ })
205
+ ```
206
+
207
+ :link-example{to="https://stackblitz.com/edit/nuxt-view-transitions?file=app.vue" target="_blank"}
208
+
209
+ ::read-more{icon="i-simple-icons-mdnwebdocs" to="https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API" target="_blank"}
210
+ Read more about the **View Transition API**.
211
+ ::
212
+
213
+ ## writeEarlyHints
214
+
215
+ Enables writing of early hints when using node server.
216
+
217
+ ```ts twoslash [nuxt.config.ts]
218
+ export default defineNuxtConfig({
219
+ experimental: {
220
+ writeEarlyHints: true
221
+ }
222
+ })
223
+ ```
224
+
225
+ ## componentIslands
226
+
227
+ Enables experimental component islands support with [`<NuxtIsland>`](/docs/api/components/nuxt-island) and `.island.vue` files.
228
+
229
+ ```ts twoslash [nuxt.config.ts]
230
+ export default defineNuxtConfig({
231
+ experimental: {
232
+ componentIslands: true // false or 'local+remote'
233
+ }
234
+ })
235
+ ```
236
+
237
+ :read-more{to="/docs/guide/directory-structure/components#server-components"}
238
+
239
+ ::read-more{icon="i-simple-icons-github" to="https://github.com/nuxt/nuxt/issues/19772" target="_blank"}
240
+ You can follow the server components roadmap on GitHub.
241
+ ::
242
+
243
+ ## configSchema
244
+
245
+ Enables config schema support.
246
+
247
+ *Enabled by default.*
248
+
249
+ ```ts twoslash [nuxt.config.ts]
250
+ export default defineNuxtConfig({
251
+ experimental: {
252
+ configSchema: true
253
+ }
254
+ })
255
+ ```
256
+
257
+ ## polyfillVueUseHead
258
+
259
+ Adds a compatibility layer for modules, plugins, or user code relying on the old `@vueuse/head` API.
260
+
261
+ ```ts twoslash [nuxt.config.ts]
262
+ export default defineNuxtConfig({
263
+ experimental: {
264
+ polyfillVueUseHead: false
265
+ }
266
+ })
267
+ ```
268
+
269
+ ## respectNoSSRHeader
270
+
271
+ Allow disabling Nuxt SSR responses by setting the `x-nuxt-no-ssr` header.
272
+
273
+ ```ts twoslash [nuxt.config.ts]
274
+ export default defineNuxtConfig({
275
+ experimental: {
276
+ respectNoSSRHeader: false
277
+ }
278
+ })
279
+ ```
280
+
281
+ ## localLayerAliases
282
+
283
+ Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to their layer source and root directories.
284
+
285
+ *Enabled by default.*
286
+
287
+ ```ts twoslash [nuxt.config.ts]
288
+ export default defineNuxtConfig({
289
+ experimental: {
290
+ localLayerAliases: true
291
+ }
292
+ })
293
+ ```
294
+
295
+ ## typedPages
296
+
297
+ Enable the new experimental typed router using [`unplugin-vue-router`](https://github.com/posva/unplugin-vue-router).
298
+
299
+ ```ts twoslash [nuxt.config.ts]
300
+ export default defineNuxtConfig({
301
+ experimental: {
302
+ typedPages: true
303
+ }
304
+ })
305
+ ```
306
+
307
+ 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.
308
+
309
+ You can even get typed params within a page by using `const route = useRoute('route-name')`.
310
+
311
+ ::important
312
+ If you use `pnpm` without `shamefully-hoist=true`, you will need to have `unplugin-vue-router` installed as a devDependency in order for this feature to work.
313
+ ::
314
+
315
+ :video-accordion{title="Watch a video from Daniel Roe explaining type-safe routing in Nuxt" videoId="SXk-L19gTZk"}
316
+
317
+ ## watcher
318
+
319
+ Set an alternative watcher that will be used as the watching service for Nuxt.
320
+
321
+ Nuxt uses `chokidar-granular` by default, which will ignore top-level directories
322
+ (like `node_modules` and `.git`) that are excluded from watching.
323
+
324
+ You can set this instead to `parcel` to use `@parcel/watcher`, which may improve
325
+ performance in large projects or on Windows platforms.
326
+
327
+ You can also set this to `chokidar` to watch all files in your source directory.
328
+
329
+ ```ts twoslash [nuxt.config.ts]
330
+ export default defineNuxtConfig({
331
+ experimental: {
332
+ watcher: 'chokidar-granular' // 'chokidar' or 'parcel' are also options
333
+ }
334
+ })
335
+ ```
336
+
337
+ ## sharedPrerenderData
338
+
339
+ Enabling this feature automatically shares payload *data* between pages that are prerendered. This can result
340
+ in a significant performance improvement when prerendering sites that use `useAsyncData` or `useFetch` and
341
+ fetch the same data in different pages.
342
+
343
+ ```ts twoslash [nuxt.config.ts]
344
+ export default defineNuxtConfig({
345
+ experimental: {
346
+ sharedPrerenderData: true
347
+ }
348
+ })
349
+ ```
350
+
351
+ :video-accordion{title="Watch a video from Alexander Lichter about the experimental sharedPrerenderData" videoId="1jUupYHVvrU"}
352
+
353
+ It is particularly important when enabling this feature to make sure that any unique key of your data
354
+ is always resolvable to the same data. For example, if you are using `useAsyncData` to fetch
355
+ data related to a particular page, you should provide a key that uniquely matches that data. (`useFetch`
356
+ should do this automatically for you.)
357
+
358
+ ```ts
359
+ // This would be unsafe in a dynamic page (e.g. `[slug].vue`) because the route slug makes a difference
360
+ // to the data fetched, but Nuxt can't know that because it's not reflected in the key.
361
+ const route = useRoute()
362
+ const { data } = await useAsyncData(async () => {
363
+ return await $fetch(`/api/my-page/${route.params.slug}`)
364
+ })
365
+ // Instead, you should use a key that uniquely identifies the data fetched.
366
+ const { data } = await useAsyncData(route.params.slug, async () => {
367
+ return await $fetch(`/api/my-page/${route.params.slug}`)
368
+ })
369
+ ```
370
+
371
+ ## clientNodeCompat
372
+
373
+ With this feature, Nuxt will automatically polyfill Node.js imports in the client build using [`unenv`](https://github.com/unjs/unenv).
374
+
375
+ ::note
376
+ To make globals like `Buffer` work in the browser, you need to manually inject them.
377
+
378
+ ```ts
379
+ import { Buffer } from 'node:buffer'
380
+
381
+ globalThis.Buffer = globalThis.Buffer || Buffer
382
+ ```
383
+ ::
384
+
385
+ ## scanPageMeta
386
+
387
+ This option allows exposing some route metadata defined in `definePageMeta` at build-time to modules (specifically `alias`, `name`, `path`, `redirect`, `props` and `middleware`).
388
+
389
+ This only works with static or strings/arrays rather than variables or conditional assignment. See [original issue](https://github.com/nuxt/nuxt/issues/24770) for more information and context.
390
+
391
+ It is also possible to scan page metadata only after all routes have been registered in `pages:extend`. Then another hook, `pages:resolved` will be called. To enable this behavior, set `scanPageMeta: 'after-resolve'`.
392
+
393
+ You can disable this feature if it causes issues in your project.
394
+
395
+ ```ts twoslash [nuxt.config.ts]
396
+ export default defineNuxtConfig({
397
+ experimental: {
398
+ scanPageMeta: false
399
+ }
400
+ })
401
+ ```
402
+
403
+ ## cookieStore
404
+
405
+ Enables CookieStore support to listen for cookie updates (if supported by the browser) and refresh `useCookie` ref values.
406
+
407
+ ```ts twoslash [nuxt.config.ts]
408
+ export default defineNuxtConfig({
409
+ experimental: {
410
+ cookieStore: true
411
+ }
412
+ })
413
+ ```
414
+
415
+ ::read-more{icon="i-simple-icons-mdnwebdocs" to="https://developer.mozilla.org/en-US/docs/Web/API/CookieStore" target="_blank"}
416
+ Read more about the **CookieStore**.
417
+ ::
418
+
419
+ ## buildCache
420
+
421
+ Caches Nuxt build artifacts based on a hash of the configuration and source files.
422
+
423
+ ```ts twoslash [nuxt.config.ts]
424
+ export default defineNuxtConfig({
425
+ experimental: {
426
+ buildCache: true
427
+ }
428
+ })
429
+ ```
430
+
431
+ When enabled, changes to the following files will trigger a full rebuild:
432
+
433
+ ```bash [Directory structure]
434
+ .nuxtrc
435
+ .npmrc
436
+ package.json
437
+ package-lock.json
438
+ yarn.lock
439
+ pnpm-lock.yaml
440
+ tsconfig.json
441
+ bun.lockb
442
+ ```
443
+
444
+ In addition, any changes to files within `srcDir` will trigger a rebuild of the Vue client/server bundle. Nitro will always be rebuilt (though work is in progress to allow Nitro to announce its cacheable artifacts and their hashes).
445
+
446
+ ::note
447
+ A maximum of 10 cache tarballs are kept.
448
+ ::
449
+
450
+ ## extraPageMetaExtractionKeys
451
+
452
+ 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.
453
+
454
+ This option allows passing additional keys to extract from the page metadata when using `scanPageMeta`.
455
+
456
+ ```vue
457
+ <script lang="ts" setup>
458
+ definePageMeta({
459
+ foo: 'bar'
460
+ })
461
+ </script>
462
+ ```
463
+
464
+ ```ts
465
+ export default defineNuxtConfig({
466
+ experimental: {
467
+ extraPageMetaExtractionKeys: ['foo'],
468
+ },
469
+ hooks: {
470
+ 'pages:resolved' (ctx) {
471
+ // ✅ foo is available
472
+ },
473
+ },
474
+ })
475
+ ```
476
+
477
+ 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/pages#typing-custom-metadata).
478
+
479
+ ## normalizeComponentNames
480
+
481
+ Ensure that auto-generated Vue component names match the full component name
482
+ you would use to auto-import the component.
483
+
484
+ ```ts twoslash [nuxt.config.ts]
485
+ export default defineNuxtConfig({
486
+ experimental: {
487
+ normalizeComponentNames: true
488
+ }
489
+ })
490
+ ```
491
+
492
+ By default, if you haven't set it manually, Vue will assign a component name that matches
493
+ the filename of the component.
494
+
495
+ ```bash [Directory structure]
496
+ ├─ components/
497
+ ├─── SomeFolder/
498
+ ├───── MyComponent.vue
499
+ ```
500
+
501
+ In this case, the component name would be `MyComponent`, as far as Vue is concerned. If you wanted to use `<KeepAlive>` with it, or identify it in the Vue DevTools, you would need to use this component.
502
+
503
+ But in order to auto-import it, you would need to use `SomeFolderMyComponent`.
504
+
505
+ By setting `experimental.normalizeComponentNames`, these two values match, and Vue will generate a component name that matches the Nuxt pattern for component naming.
506
+
507
+ ## spaLoadingTemplateLocation
508
+
509
+ When rendering a client-only page (with `ssr: false`), we optionally render a loading screen (from `app/spa-loading-template.html`).
510
+
511
+ It can be set to `within`, which will render it like this:
512
+
513
+ ```html
514
+ <div id="__nuxt">
515
+ <!-- spa loading template -->
516
+ </div>
517
+ ```
518
+
519
+ Alternatively, you can render the template alongside the Nuxt app root by setting it to `body`:
520
+
521
+ ```html
522
+ <div id="__nuxt"></div>
523
+ <!-- spa loading template -->
524
+ ```
525
+
526
+ This avoids a white flash when hydrating a client-only page.
527
+
528
+ ## browserDevtoolsTiming
529
+
530
+ Enables performance markers for Nuxt hooks in browser devtools. This adds performance markers that you can track in the Performance tab of Chromium-based browsers, which is useful for debugging and optimizing performance.
531
+
532
+ This is enabled by default in development mode. If you need to disable this feature, it is possible to do so:
533
+
534
+ ```ts twoslash [nuxt.config.ts]
535
+ export default defineNuxtConfig({
536
+ experimental: {
537
+ browserDevtoolsTiming: false
538
+ }
539
+ })
540
+ ```
541
+
542
+ ::read-more{icon="i-simple-icons-github" color="gray" to="https://github.com/nuxt/nuxt/pull/29922" target="_blank"}
543
+ See PR #29922 for implementation details.
544
+ ::
545
+
546
+ ::read-more{icon="i-simple-icons-googlechrome" color="gray" to="https://developer.chrome.com/docs/devtools/performance/extension#tracks" target="_blank"}
547
+ Learn more about Chrome DevTools Performance API.
548
+ ::
549
+
550
+ ## debugModuleMutation
551
+
552
+ Records mutations to `nuxt.options` in module context, helping to debug configuration changes made by modules during the Nuxt initialization phase.
553
+
554
+ This is enabled by default when `debug` mode is enabled. If you need to disable this feature, it is possible to do so:
555
+
556
+ To enable it explicitly:
557
+
558
+ ```ts twoslash [nuxt.config.ts]
559
+ export default defineNuxtConfig({
560
+ experimental: {
561
+ debugModuleMutation: true
562
+ }
563
+ })
564
+ ```
565
+
566
+ ::read-more{icon="i-simple-icons-github" color="gray" to="https://github.com/nuxt/nuxt/pull/30555" target="_blank"}
567
+ See PR #30555 for implementation details.
568
+ ::
569
+
570
+ ## lazyHydration
571
+
572
+ This enables hydration strategies for `<Lazy>` components, which improves performance by deferring hydration of components until they're needed.
573
+
574
+ Lazy hydration is enabled by default, but you can disable this feature:
575
+
576
+ ```ts twoslash [nuxt.config.ts]
577
+ export default defineNuxtConfig({
578
+ experimental: {
579
+ lazyHydration: false
580
+ }
581
+ })
582
+ ```
583
+
584
+ ::read-more{icon="i-simple-icons-github" color="gray" to="/docs/guide/directory-structure/components#delayed-or-lazy-hydration"}
585
+ Read more about lazy hydration.
586
+ ::
587
+
588
+ ## templateImportResolution
589
+
590
+ Controls how imports in Nuxt templates are resolved. By default, Nuxt attempts to resolve imports in templates relative to the module that added them.
591
+
592
+ This is enabled by default, so if you're experiencing resolution conflicts in certain environments, you can disable this behavior:
593
+
594
+ ```ts twoslash [nuxt.config.ts]
595
+ export default defineNuxtConfig({
596
+ experimental: {
597
+ templateImportResolution: false
598
+ }
599
+ })
600
+ ```
601
+
602
+ ::read-more{icon="i-simple-icons-github" color="gray" to="https://github.com/nuxt/nuxt/pull/31175" target="_blank"}
603
+ See PR #31175 for implementation details.
604
+ ::
605
+
606
+ ## decorators
607
+
608
+ 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).
609
+
610
+ For a long time, TypeScript has had support for decorators via `compilerOptions.experimentalDecorators`. This implementation predated the TC39 standardization process. Now, decorators are a [Stage 3 Proposal](https://github.com/tc39/proposal-decorators), and supported without special configuration in TS 5.0+ (see https://github.com/microsoft/TypeScript/pull/52582 and https://devblogs.microsoft.com/typescript/announcing-typescript-5-0-beta/#decorators).
611
+
612
+ Enabling `experimental.decorators` enables support for the TC39 proposal, **NOT** for TypeScript's previous `compilerOptions.experimentalDecorators` implementation.
613
+
614
+ ::warning
615
+ Note that there may be changes before this finally lands in the JS standard.
616
+ ::
617
+
618
+ ### Usage
619
+
620
+ ```ts twoslash [nuxt.config.ts]
621
+ export default defineNuxtConfig({
622
+ experimental: {
623
+ decorators: true,
624
+ },
625
+ })
626
+ ```
627
+
628
+ ```ts [app.vue]
629
+ function something (_method: () => unknown) {
630
+ return () => 'decorated'
631
+ }
632
+
633
+ class SomeClass {
634
+ @something
635
+ public someMethod () {
636
+ return 'initial'
637
+ }
638
+ }
639
+
640
+ const value = new SomeClass().someMethod()
641
+ // this will return 'decorated'
642
+ ```
643
+
644
+ ## purgeCachedData
645
+
646
+ Nuxt will automatically purge cached data from `useAsyncData` and `nuxtApp.static.data`. This helps prevent memory leaks
647
+ and ensures fresh data is loaded when needed, but it is possible to disable it:
648
+
649
+ ```ts twoslash [nuxt.config.ts]
650
+ export default defineNuxtConfig({
651
+ experimental: {
652
+ purgeCachedData: false
653
+ }
654
+ })
655
+ ```
656
+
657
+ ::read-more{icon="i-simple-icons-github" color="gray" to="https://github.com/nuxt/nuxt/pull/31379" target="_blank"}
658
+ See PR #31379 for implementation details.
659
+ ::
660
+
661
+ ## granularCachedData
662
+
663
+ 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.
664
+
665
+ ```ts twoslash [nuxt.config.ts]
666
+ export default defineNuxtConfig({
667
+ experimental: {
668
+ granularCachedData: true
669
+ }
670
+ })
671
+ ```
672
+
673
+ ::read-more{icon="i-simple-icons-github" color="gray" to="https://github.com/nuxt/nuxt/pull/31373" target="_blank"}
674
+ See PR #31373 for implementation details.
675
+ ::
676
+
677
+ ## pendingWhenIdle
678
+
679
+ 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.
680
+
681
+ That means that when `immediate: false` is passed, `pending` will be `false` until the first request is made.
682
+
683
+ ```ts twoslash [nuxt.config.ts]
684
+ export default defineNuxtConfig({
685
+ experimental: {
686
+ pendingWhenIdle: false
687
+ }
688
+ })
689
+ ```