@nuxt/docs-nightly 4.1.3-29300098.2f71703a → 4.1.3-29303775.dc69e26c

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 (146) hide show
  1. package/1.getting-started/01.introduction.md +2 -2
  2. package/1.getting-started/03.configuration.md +10 -10
  3. package/1.getting-started/04.views.md +6 -6
  4. package/1.getting-started/05.assets.md +7 -7
  5. package/1.getting-started/06.styling.md +5 -5
  6. package/1.getting-started/07.routing.md +8 -8
  7. package/1.getting-started/08.seo-meta.md +10 -10
  8. package/1.getting-started/09.transitions.md +11 -11
  9. package/1.getting-started/10.data-fetching.md +36 -36
  10. package/1.getting-started/11.state-management.md +7 -7
  11. package/1.getting-started/12.error-handling.md +9 -9
  12. package/1.getting-started/14.layers.md +3 -3
  13. package/1.getting-started/15.prerendering.md +4 -4
  14. package/1.getting-started/16.deployment.md +2 -2
  15. package/1.getting-started/17.testing.md +3 -3
  16. package/1.getting-started/18.upgrade.md +3 -3
  17. package/2.guide/1.concepts/1.auto-imports.md +8 -8
  18. package/2.guide/1.concepts/10.nuxt-lifecycle.md +10 -10
  19. package/2.guide/1.concepts/2.vuejs-development.md +4 -4
  20. package/2.guide/1.concepts/3.rendering.md +9 -9
  21. package/2.guide/1.concepts/4.server-engine.md +5 -5
  22. package/2.guide/1.concepts/5.modules.md +2 -2
  23. package/2.guide/1.concepts/7.esm.md +3 -3
  24. package/2.guide/1.concepts/8.typescript.md +8 -8
  25. package/2.guide/2.directory-structure/0.nuxt.md +2 -2
  26. package/2.guide/2.directory-structure/0.output.md +2 -2
  27. package/2.guide/2.directory-structure/1.app/1.assets.md +2 -2
  28. package/2.guide/2.directory-structure/1.app/1.components.md +5 -5
  29. package/2.guide/2.directory-structure/1.app/1.composables.md +3 -3
  30. package/2.guide/2.directory-structure/1.app/1.layouts.md +6 -6
  31. package/2.guide/2.directory-structure/1.app/1.middleware.md +7 -7
  32. package/2.guide/2.directory-structure/1.app/1.pages.md +14 -14
  33. package/2.guide/2.directory-structure/1.app/1.plugins.md +7 -7
  34. package/2.guide/2.directory-structure/1.app/1.utils.md +3 -3
  35. package/2.guide/2.directory-structure/1.app/3.app-config.md +5 -5
  36. package/2.guide/2.directory-structure/1.app/3.app.md +3 -3
  37. package/2.guide/2.directory-structure/1.app/3.error.md +1 -1
  38. package/2.guide/2.directory-structure/1.content.md +2 -2
  39. package/2.guide/2.directory-structure/1.modules.md +2 -2
  40. package/2.guide/2.directory-structure/1.node_modules.md +1 -1
  41. package/2.guide/2.directory-structure/1.server.md +5 -5
  42. package/2.guide/2.directory-structure/1.shared.md +2 -2
  43. package/2.guide/2.directory-structure/2.env.md +4 -4
  44. package/2.guide/2.directory-structure/2.nuxtignore.md +3 -3
  45. package/2.guide/2.directory-structure/2.nuxtrc.md +2 -2
  46. package/2.guide/2.directory-structure/3.nuxt-config.md +1 -1
  47. package/2.guide/2.directory-structure/3.tsconfig.md +2 -2
  48. package/2.guide/3.going-further/1.experimental-features.md +9 -9
  49. package/2.guide/3.going-further/1.internals.md +10 -10
  50. package/2.guide/3.going-further/10.runtime-config.md +4 -4
  51. package/2.guide/3.going-further/2.hooks.md +3 -3
  52. package/2.guide/3.going-further/3.modules.md +16 -16
  53. package/2.guide/3.going-further/4.kit.md +2 -2
  54. package/2.guide/3.going-further/6.nuxt-app.md +4 -4
  55. package/2.guide/3.going-further/7.layers.md +11 -11
  56. package/2.guide/4.recipes/1.custom-routing.md +11 -11
  57. package/2.guide/4.recipes/2.vite-plugin.md +1 -1
  58. package/2.guide/4.recipes/3.custom-usefetch.md +3 -3
  59. package/2.guide/4.recipes/4.sessions-and-authentication.md +1 -1
  60. package/2.guide/5.best-practices/hydration.md +4 -4
  61. package/2.guide/5.best-practices/performance.md +4 -4
  62. package/3.api/1.components/10.nuxt-picture.md +1 -1
  63. package/3.api/1.components/12.nuxt-route-announcer.md +2 -2
  64. package/3.api/1.components/2.nuxt-page.md +2 -2
  65. package/3.api/1.components/3.nuxt-layout.md +2 -2
  66. package/3.api/1.components/4.nuxt-link.md +3 -3
  67. package/3.api/1.components/5.nuxt-loading-indicator.md +2 -2
  68. package/3.api/2.composables/use-async-data.md +6 -6
  69. package/3.api/2.composables/use-cookie.md +2 -2
  70. package/3.api/2.composables/use-fetch.md +4 -4
  71. package/3.api/2.composables/use-head-safe.md +2 -2
  72. package/3.api/2.composables/use-head.md +2 -2
  73. package/3.api/2.composables/use-hydration.md +1 -1
  74. package/3.api/2.composables/use-lazy-async-data.md +2 -2
  75. package/3.api/2.composables/use-lazy-fetch.md +2 -2
  76. package/3.api/2.composables/use-loading-indicator.md +2 -2
  77. package/3.api/2.composables/use-nuxt-app.md +12 -12
  78. package/3.api/2.composables/use-nuxt-data.md +1 -1
  79. package/3.api/2.composables/use-preview-mode.md +3 -3
  80. package/3.api/2.composables/use-request-event.md +1 -1
  81. package/3.api/2.composables/use-request-fetch.md +2 -2
  82. package/3.api/2.composables/use-request-header.md +1 -1
  83. package/3.api/2.composables/use-request-headers.md +1 -1
  84. package/3.api/2.composables/use-request-url.md +1 -1
  85. package/3.api/2.composables/use-response-header.md +2 -2
  86. package/3.api/2.composables/use-route-announcer.md +1 -1
  87. package/3.api/2.composables/use-route.md +1 -1
  88. package/3.api/2.composables/use-router.md +4 -4
  89. package/3.api/2.composables/use-runtime-hook.md +1 -1
  90. package/3.api/2.composables/use-seo-meta.md +1 -1
  91. package/3.api/2.composables/use-server-seo-meta.md +3 -3
  92. package/3.api/2.composables/use-state.md +1 -1
  93. package/3.api/3.utils/$fetch.md +4 -4
  94. package/3.api/3.utils/abort-navigation.md +1 -1
  95. package/3.api/3.utils/add-route-middleware.md +2 -2
  96. package/3.api/3.utils/call-once.md +1 -1
  97. package/3.api/3.utils/clear-error.md +1 -1
  98. package/3.api/3.utils/clear-nuxt-data.md +1 -1
  99. package/3.api/3.utils/clear-nuxt-state.md +1 -1
  100. package/3.api/3.utils/define-nuxt-plugin.md +3 -3
  101. package/3.api/3.utils/define-nuxt-route-middleware.md +3 -3
  102. package/3.api/3.utils/define-page-meta.md +8 -8
  103. package/3.api/3.utils/define-route-rules.md +2 -2
  104. package/3.api/3.utils/navigate-to.md +1 -1
  105. package/3.api/3.utils/prefetch-components.md +1 -1
  106. package/3.api/3.utils/prerender-routes.md +1 -1
  107. package/3.api/3.utils/refresh-nuxt-data.md +2 -2
  108. package/3.api/3.utils/set-page-layout.md +1 -1
  109. package/3.api/3.utils/set-response-status.md +1 -1
  110. package/3.api/3.utils/show-error.md +2 -2
  111. package/3.api/3.utils/update-app-config.md +1 -1
  112. package/3.api/4.commands/module.md +2 -2
  113. package/3.api/4.commands/prepare.md +1 -1
  114. package/3.api/4.commands/preview.md +2 -2
  115. package/3.api/4.commands/typecheck.md +1 -1
  116. package/3.api/5.kit/10.runtime-config.md +1 -1
  117. package/3.api/5.kit/3.compatibility.md +2 -2
  118. package/3.api/5.kit/4.autoimports.md +1 -1
  119. package/3.api/5.kit/5.components.md +2 -2
  120. package/3.api/5.kit/7.pages.md +3 -3
  121. package/3.api/5.kit/8.layout.md +1 -1
  122. package/3.api/6.advanced/1.hooks.md +2 -2
  123. package/3.api/6.nuxt-config.md +4 -4
  124. package/5.community/2.getting-help.md +1 -1
  125. package/5.community/3.reporting-bugs.md +1 -1
  126. package/5.community/4.contribution.md +10 -10
  127. package/5.community/5.framework-contribution.md +4 -4
  128. package/5.community/6.roadmap.md +1 -1
  129. package/6.bridge/1.overview.md +12 -12
  130. package/6.bridge/2.typescript.md +1 -1
  131. package/6.bridge/3.bridge-composition-api.md +5 -5
  132. package/6.bridge/4.plugins-and-middleware.md +4 -4
  133. package/6.bridge/5.nuxt3-compatible-api.md +9 -9
  134. package/6.bridge/6.meta.md +5 -5
  135. package/6.bridge/7.runtime-config.md +1 -1
  136. package/6.bridge/8.nitro.md +1 -1
  137. package/6.bridge/9.vite.md +1 -1
  138. package/7.migration/1.overview.md +2 -2
  139. package/7.migration/2.configuration.md +5 -5
  140. package/7.migration/20.module-authors.md +6 -6
  141. package/7.migration/3.auto-imports.md +3 -3
  142. package/7.migration/4.meta.md +3 -3
  143. package/7.migration/6.pages-and-layouts.md +8 -8
  144. package/7.migration/7.component-options.md +11 -11
  145. package/7.migration/8.runtime-config.md +3 -3
  146. package/package.json +1 -1
@@ -4,23 +4,23 @@ description: Nuxt provides composables to handle data fetching within your appli
4
4
  navigation.icon: i-lucide-cable
5
5
  ---
6
6
 
7
- Nuxt comes with two composables and a built-in library to perform data-fetching in browser or server environments: `useFetch`, [`useAsyncData`](/docs/api/composables/use-async-data) and `$fetch`.
7
+ Nuxt comes with two composables and a built-in library to perform data-fetching in browser or server environments: `useFetch`, [`useAsyncData`](/docs/4.x/api/composables/use-async-data) and `$fetch`.
8
8
 
9
9
  In a nutshell:
10
10
 
11
- - [`$fetch`](/docs/api/utils/dollarfetch) is the simplest way to make a network request.
12
- - [`useFetch`](/docs/api/composables/use-fetch) is a wrapper around `$fetch` that fetches data only once in [universal rendering](/docs/guide/concepts/rendering#universal-rendering).
13
- - [`useAsyncData`](/docs/api/composables/use-async-data) is similar to `useFetch` but offers more fine-grained control.
11
+ - [`$fetch`](/docs/4.x/api/utils/dollarfetch) is the simplest way to make a network request.
12
+ - [`useFetch`](/docs/4.x/api/composables/use-fetch) is a wrapper around `$fetch` that fetches data only once in [universal rendering](/docs/4.x/guide/concepts/rendering#universal-rendering).
13
+ - [`useAsyncData`](/docs/4.x/api/composables/use-async-data) is similar to `useFetch` but offers more fine-grained control.
14
14
 
15
15
  Both `useFetch` and `useAsyncData` share a common set of options and patterns that we will detail in the last sections.
16
16
 
17
17
  ## The need for `useFetch` and `useAsyncData`
18
18
 
19
- Nuxt is a framework which can run isomorphic (or universal) code in both server and client environments. If the [`$fetch` function](/docs/api/utils/dollarfetch) is used to perform data fetching in the setup function of a Vue component, this may cause data to be fetched twice, once on the server (to render the HTML) and once again on the client (when the HTML is hydrated). This can cause hydration issues, increase the time to interactivity and cause unpredictable behavior.
19
+ Nuxt is a framework which can run isomorphic (or universal) code in both server and client environments. If the [`$fetch` function](/docs/4.x/api/utils/dollarfetch) is used to perform data fetching in the setup function of a Vue component, this may cause data to be fetched twice, once on the server (to render the HTML) and once again on the client (when the HTML is hydrated). This can cause hydration issues, increase the time to interactivity and cause unpredictable behavior.
20
20
 
21
- The [`useFetch`](/docs/api/composables/use-fetch) and [`useAsyncData`](/docs/api/composables/use-async-data) composables solve this problem by ensuring that if an API call is made on the server, the data is forwarded to the client in the payload.
21
+ The [`useFetch`](/docs/4.x/api/composables/use-fetch) and [`useAsyncData`](/docs/4.x/api/composables/use-async-data) composables solve this problem by ensuring that if an API call is made on the server, the data is forwarded to the client in the payload.
22
22
 
23
- The payload is a JavaScript object accessible through [`useNuxtApp().payload`](/docs/api/composables/use-nuxt-app#payload). It is used on the client to avoid refetching the same data when the code is executed in the browser [during hydration](/docs/guide/concepts/rendering#universal-rendering).
23
+ The payload is a JavaScript object accessible through [`useNuxtApp().payload`](/docs/4.x/api/composables/use-nuxt-app#payload). It is used on the client to avoid refetching the same data when the code is executed in the browser [during hydration](/docs/4.x/guide/concepts/rendering#universal-rendering).
24
24
 
25
25
  ::tip
26
26
  Use the [Nuxt DevTools](https://devtools.nuxt.com) to inspect this data in the **Payload tab**.
@@ -59,7 +59,7 @@ In the example above, `useFetch` would make sure that the request would occur in
59
59
  Nuxt uses Vue's [`<Suspense>`](https://vuejs.org/guide/built-ins/suspense) component under the hood to prevent navigation before every async data is available to the view. The data fetching composables can help you leverage this feature and use what suits best on a per-call basis.
60
60
 
61
61
  ::note
62
- You can add the [`<NuxtLoadingIndicator>`](/docs/api/components/nuxt-loading-indicator) to add a progress bar between page navigations.
62
+ You can add the [`<NuxtLoadingIndicator>`](/docs/4.x/api/components/nuxt-loading-indicator) to add a progress bar between page navigations.
63
63
  ::
64
64
 
65
65
  ## `$fetch`
@@ -80,8 +80,8 @@ async function addTodo() {
80
80
  ```
81
81
 
82
82
  ::warning
83
- Beware that using only `$fetch` will not provide [network calls de-duplication and navigation prevention](#the-need-for-usefetch-and-useasyncdata). :br
84
- It is recommended to use `$fetch` for client-side interactions (event-based) or combined with [`useAsyncData`](#useasyncdata) when fetching the initial component data.
83
+ Beware that using only `$fetch` will not provide [network calls de-duplication and navigation prevention](/docs/getting-started/data-fetching#the-need-for-usefetch-and-useasyncdata). :br
84
+ It is recommended to use `$fetch` for client-side interactions (event-based) or combined with [`useAsyncData`](/docs/getting-started/data-fetching#useasyncdata) when fetching the initial component data.
85
85
  ::
86
86
 
87
87
  ::read-more{to="/docs/api/utils/dollarfetch"}
@@ -90,7 +90,7 @@ Read more about `$fetch`.
90
90
 
91
91
  ### Pass Client Headers to the API
92
92
 
93
- When calling `useFetch` on the server, Nuxt will use [`useRequestFetch`](/docs/api/composables/use-request-fetch) to proxy client headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
93
+ When calling `useFetch` on the server, Nuxt will use [`useRequestFetch`](/docs/4.x/api/composables/use-request-fetch) to proxy client headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
94
94
 
95
95
  ```vue
96
96
  <script setup lang="ts">
@@ -103,7 +103,7 @@ const { data } = await useFetch('/api/echo');
103
103
  export default defineEventHandler(event => parseCookies(event))
104
104
  ```
105
105
 
106
- Alternatively, the example below shows how to use [`useRequestHeaders`](/docs/api/composables/use-request-headers) to access and send cookies to the API from a server-side request (originating on the client). Using an isomorphic `$fetch` call, we ensure that the API endpoint has access to the same `cookie` header originally sent by the user's browser. This is only necessary if you aren't using `useFetch`.
106
+ Alternatively, the example below shows how to use [`useRequestHeaders`](/docs/4.x/api/composables/use-request-headers) to access and send cookies to the API from a server-side request (originating on the client). Using an isomorphic `$fetch` call, we ensure that the API endpoint has access to the same `cookie` header originally sent by the user's browser. This is only necessary if you aren't using `useFetch`.
107
107
 
108
108
  ```vue
109
109
  <script setup lang="ts">
@@ -116,7 +116,7 @@ async function getCurrentUser() {
116
116
  ```
117
117
 
118
118
  ::tip
119
- You can also use [`useRequestFetch`](/docs/api/composables/use-request-fetch) to proxy headers to the call automatically.
119
+ You can also use [`useRequestFetch`](/docs/4.x/api/composables/use-request-fetch) to proxy headers to the call automatically.
120
120
  ::
121
121
 
122
122
  ::caution
@@ -130,7 +130,7 @@ Be very careful before proxying headers to an external API and just include head
130
130
 
131
131
  ## `useFetch`
132
132
 
133
- The [`useFetch`](/docs/api/composables/use-fetch) composable uses `$fetch` under-the-hood to make SSR-safe network calls in the setup function.
133
+ The [`useFetch`](/docs/4.x/api/composables/use-fetch) composable uses `$fetch` under-the-hood to make SSR-safe network calls in the setup function.
134
134
 
135
135
  ```vue twoslash [app/app.vue]
136
136
  <script setup lang="ts">
@@ -142,7 +142,7 @@ const { data: count } = await useFetch('/api/count')
142
142
  </template>
143
143
  ```
144
144
 
145
- This composable is a wrapper around the [`useAsyncData`](/docs/api/composables/use-async-data) composable and `$fetch` utility.
145
+ This composable is a wrapper around the [`useAsyncData`](/docs/4.x/api/composables/use-async-data) composable and `$fetch` utility.
146
146
 
147
147
  :video-accordion{title="Watch a video from Alexander Lichter to avoid using useFetch the wrong way" videoId="njsGVmcWviY"}
148
148
 
@@ -156,12 +156,12 @@ The `useAsyncData` composable is responsible for wrapping async logic and return
156
156
 
157
157
  ::tip
158
158
  `useFetch(url)` is nearly equivalent to `useAsyncData(url, () => event.$fetch(url))`. :br
159
- It's developer experience sugar for the most common use case. (You can find out more about `event.fetch` at [`useRequestFetch`](/docs/api/composables/use-request-fetch).)
159
+ It's developer experience sugar for the most common use case. (You can find out more about `event.fetch` at [`useRequestFetch`](/docs/4.x/api/composables/use-request-fetch).)
160
160
  ::
161
161
 
162
162
  :video-accordion{title="Watch a video from Alexander Lichter to dig deeper into the difference between useFetch and useAsyncData" videoId="0X-aOpSGabA"}
163
163
 
164
- There are some cases when using the [`useFetch`](/docs/api/composables/use-fetch) composable is not appropriate, for example when a CMS or a third-party provide their own query layer. In this case, you can use [`useAsyncData`](/docs/api/composables/use-async-data) to wrap your calls and still keep the benefits provided by the composable.
164
+ There are some cases when using the [`useFetch`](/docs/4.x/api/composables/use-fetch) composable is not appropriate, for example when a CMS or a third-party provide their own query layer. In this case, you can use [`useAsyncData`](/docs/4.x/api/composables/use-async-data) to wrap your calls and still keep the benefits provided by the composable.
165
165
 
166
166
  ```vue [app/pages/users.vue]
167
167
  <script setup lang="ts">
@@ -173,11 +173,11 @@ const { data, error } = await useAsyncData(() => myGetFunction('users'))
173
173
  ```
174
174
 
175
175
  ::note
176
- The first argument of [`useAsyncData`](/docs/api/composables/use-async-data) is a unique key used to cache the response of the second argument, the querying function. This key can be ignored by directly passing the querying function, the key will be auto-generated.
176
+ The first argument of [`useAsyncData`](/docs/4.x/api/composables/use-async-data) is a unique key used to cache the response of the second argument, the querying function. This key can be ignored by directly passing the querying function, the key will be auto-generated.
177
177
  :br :br
178
178
  Since the autogenerated key only takes into account the file and line where `useAsyncData` is invoked, it is recommended to always create your own key to avoid unwanted behavior, like when you are creating your own custom composable wrapping `useAsyncData`.
179
179
  :br :br
180
- Setting a key can be useful to share the same data between components using [`useNuxtData`](/docs/api/composables/use-nuxt-data) or to [refresh specific data](/docs/api/utils/refresh-nuxt-data#refresh-specific-data).
180
+ Setting a key can be useful to share the same data between components using [`useNuxtData`](/docs/4.x/api/composables/use-nuxt-data) or to [refresh specific data](/docs/4.x/api/utils/refresh-nuxt-data#refresh-specific-data).
181
181
  ::
182
182
 
183
183
  ```vue [app/pages/users/[id\\].vue]
@@ -208,7 +208,7 @@ const { data: discounts, status } = await useAsyncData('cart-discount', async ()
208
208
  ```
209
209
 
210
210
  ::note
211
- `useAsyncData` is for fetching and caching data, not triggering side effects like calling Pinia actions, as this can cause unintended behavior such as repeated executions with nullish values. If you need to trigger side effects, use the [`callOnce`](/docs/api/utils/call-once) utility to do so.
211
+ `useAsyncData` is for fetching and caching data, not triggering side effects like calling Pinia actions, as this can cause unintended behavior such as repeated executions with nullish values. If you need to trigger side effects, use the [`callOnce`](/docs/4.x/api/utils/call-once) utility to do so.
212
212
 
213
213
  ```vue
214
214
  <script setup lang="ts">
@@ -246,7 +246,7 @@ If you have not fetched data on the server (for example, with `server: false`),
246
246
 
247
247
  ## Options
248
248
 
249
- [`useAsyncData`](/docs/api/composables/use-async-data) and [`useFetch`](/docs/api/composables/use-fetch) return the same object type and accept a common set of options as their last argument. They can help you control the composables behavior, such as navigation blocking, caching or execution.
249
+ [`useAsyncData`](/docs/4.x/api/composables/use-async-data) and [`useFetch`](/docs/4.x/api/composables/use-fetch) return the same object type and accept a common set of options as their last argument. They can help you control the composables behavior, such as navigation blocking, caching or execution.
250
250
 
251
251
  ### Lazy
252
252
 
@@ -272,7 +272,7 @@ const { status, data: posts } = useFetch('/api/posts', {
272
272
  </template>
273
273
  ```
274
274
 
275
- You can alternatively use [`useLazyFetch`](/docs/api/composables/use-lazy-fetch) and `useLazyAsyncData` as convenient methods to perform the same.
275
+ You can alternatively use [`useLazyFetch`](/docs/4.x/api/composables/use-lazy-fetch) and `useLazyAsyncData` as convenient methods to perform the same.
276
276
 
277
277
  ```vue twoslash
278
278
  <script setup lang="ts">
@@ -307,7 +307,7 @@ const { status, data: comments } = useFetch('/api/comments', {
307
307
  })
308
308
  ```
309
309
 
310
- The `useFetch` composable is meant to be invoked in setup method or called directly at the top level of a function in lifecycle hooks, otherwise you should use [`$fetch` method](#fetch).
310
+ The `useFetch` composable is meant to be invoked in setup method or called directly at the top level of a function in lifecycle hooks, otherwise you should use [`$fetch` method](/docs/getting-started/data-fetching#fetch).
311
311
 
312
312
  ### Minimize payload size
313
313
 
@@ -347,13 +347,13 @@ Both `pick` and `transform` don't prevent the unwanted data from being fetched i
347
347
 
348
348
  #### Keys
349
349
 
350
- [`useFetch`](/docs/api/composables/use-fetch) and [`useAsyncData`](/docs/api/composables/use-async-data) use keys to prevent refetching the same data.
350
+ [`useFetch`](/docs/4.x/api/composables/use-fetch) and [`useAsyncData`](/docs/4.x/api/composables/use-async-data) use keys to prevent refetching the same data.
351
351
 
352
- - [`useFetch`](/docs/api/composables/use-fetch) uses the provided URL as a key. Alternatively, a `key` value can be provided in the `options` object passed as a last argument.
353
- - [`useAsyncData`](/docs/api/composables/use-async-data) uses its first argument as a key if it is a string. If the first argument is the handler function that performs the query, then a key that is unique to the file name and line number of the instance of `useAsyncData` will be generated for you.
352
+ - [`useFetch`](/docs/4.x/api/composables/use-fetch) uses the provided URL as a key. Alternatively, a `key` value can be provided in the `options` object passed as a last argument.
353
+ - [`useAsyncData`](/docs/4.x/api/composables/use-async-data) uses its first argument as a key if it is a string. If the first argument is the handler function that performs the query, then a key that is unique to the file name and line number of the instance of `useAsyncData` will be generated for you.
354
354
 
355
355
  ::tip
356
- To get the cached data by key, you can use [`useNuxtData`](/docs/api/composables/use-nuxt-data)
356
+ To get the cached data by key, you can use [`useNuxtData`](/docs/4.x/api/composables/use-nuxt-data)
357
357
  ::
358
358
 
359
359
  :video-accordion{title="Watch a video from Vue School on caching data with the key option" videoId="1026410044" platform="vimeo"}
@@ -431,10 +431,10 @@ const { data, error, execute, refresh } = await useFetch('/api/users')
431
431
  </template>
432
432
  ```
433
433
 
434
- The `execute` function is an alias for `refresh` that works in exactly the same way but is more semantic for cases when the fetch is [not immediate](#not-immediate).
434
+ The `execute` function is an alias for `refresh` that works in exactly the same way but is more semantic for cases when the fetch is [not immediate](/docs/getting-started/data-fetching#not-immediate).
435
435
 
436
436
  ::tip
437
- To globally refetch or invalidate cached data, see [`clearNuxtData`](/docs/api/utils/clear-nuxt-data) and [`refreshNuxtData`](/docs/api/utils/refresh-nuxt-data).
437
+ To globally refetch or invalidate cached data, see [`clearNuxtData`](/docs/4.x/api/utils/clear-nuxt-data) and [`refreshNuxtData`](/docs/4.x/api/utils/refresh-nuxt-data).
438
438
  ::
439
439
 
440
440
  #### Clear
@@ -479,7 +479,7 @@ const { data, error, refresh } = await useFetch(`/api/users/${id.value}`, {
479
479
  </script>
480
480
  ```
481
481
 
482
- If you need to change the URL based on a reactive value, you may want to use a [computed URL](#computed-url) instead.
482
+ If you need to change the URL based on a reactive value, you may want to use a [computed URL](/docs/getting-started/data-fetching#computed-url) instead.
483
483
 
484
484
  #### Computed URL
485
485
 
@@ -499,7 +499,7 @@ const { data, status } = useLazyFetch('/api/user', {
499
499
 
500
500
  In the case of more complex URL construction, you may use a callback as a [computed getter](https://vuejs.org/guide/essentials/computed.html) that returns the URL string.
501
501
 
502
- Every time a dependency changes, the data will be fetched using the newly constructed URL. Combine this with [not-immediate](#not-immediate), and you can wait until the reactive element changes before fetching.
502
+ Every time a dependency changes, the data will be fetched using the newly constructed URL. Combine this with [not-immediate](/docs/getting-started/data-fetching#not-immediate), and you can wait until the reactive element changes before fetching.
503
503
 
504
504
  ```vue
505
505
  <script setup lang="ts">
@@ -532,7 +532,7 @@ const pending = computed(() => status.value === 'pending');
532
532
  </template>
533
533
  ```
534
534
 
535
- If you need to force a refresh when other reactive values change, you can also [watch other values](#watch).
535
+ If you need to force a refresh when other reactive values change, you can also [watch other values](/docs/getting-started/data-fetching#watch).
536
536
 
537
537
  ### Not immediate
538
538
 
@@ -575,7 +575,7 @@ When we call `$fetch` in the browser, user headers like `cookie` will be directl
575
575
 
576
576
  Normally, during server-side-rendering, due to security considerations, the `$fetch` wouldn't include the user's browser cookies, nor pass on cookies from the fetch response.
577
577
 
578
- However, when calling `useFetch` with a relative URL on the server, Nuxt will use [`useRequestFetch`](/docs/api/composables/use-request-fetch) to proxy headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
578
+ However, when calling `useFetch` with a relative URL on the server, Nuxt will use [`useRequestFetch`](/docs/4.x/api/composables/use-request-fetch) to proxy headers and cookies (with the exception of headers not meant to be forwarded, like `host`).
579
579
 
580
580
  ### Pass Cookies From Server-side API Calls on SSR Response
581
581
 
@@ -636,9 +636,9 @@ Using `<script setup>` or `<script setup lang="ts">` are the recommended way of
636
636
 
637
637
  ## Serializing Data From Server to Client
638
638
 
639
- When using `useAsyncData` and `useLazyAsyncData` to transfer data fetched on server to the client (as well as anything else that utilizes [the Nuxt payload](/docs/api/composables/use-nuxt-app#payload)), the payload is serialized with [`devalue`](https://github.com/Rich-Harris/devalue). This allows us to transfer not just basic JSON but also to serialize and revive/deserialize more advanced kinds of data, such as regular expressions, Dates, Map and Set, `ref`, `reactive`, `shallowRef`, `shallowReactive` and `NuxtError` - and more.
639
+ When using `useAsyncData` and `useLazyAsyncData` to transfer data fetched on server to the client (as well as anything else that utilizes [the Nuxt payload](/docs/4.x/api/composables/use-nuxt-app#payload)), the payload is serialized with [`devalue`](https://github.com/Rich-Harris/devalue). This allows us to transfer not just basic JSON but also to serialize and revive/deserialize more advanced kinds of data, such as regular expressions, Dates, Map and Set, `ref`, `reactive`, `shallowRef`, `shallowReactive` and `NuxtError` - and more.
640
640
 
641
- It is also possible to define your own serializer/deserializer for types that are not supported by Nuxt. You can read more in the [`useNuxtApp`](/docs/api/composables/use-nuxt-app#payload) docs.
641
+ It is also possible to define your own serializer/deserializer for types that are not supported by Nuxt. You can read more in the [`useNuxtApp`](/docs/4.x/api/composables/use-nuxt-app#payload) docs.
642
642
 
643
643
  ::note
644
644
  Note that this _does not apply_ to data passed from your server routes when fetched with `$fetch` or `useFetch` - see the next section for more information.
@@ -646,7 +646,7 @@ Note that this _does not apply_ to data passed from your server routes when fetc
646
646
 
647
647
  ## Serializing Data From API Routes
648
648
 
649
- When fetching data from the `server` directory, the response is serialized using `JSON.stringify`. However, since serialization is limited to only JavaScript primitive types, Nuxt does its best to convert the return type of `$fetch` and [`useFetch`](/docs/api/composables/use-fetch) to match the actual value.
649
+ When fetching data from the `server` directory, the response is serialized using `JSON.stringify`. However, since serialization is limited to only JavaScript primitive types, Nuxt does its best to convert the return type of `$fetch` and [`useFetch`](/docs/4.x/api/composables/use-fetch) to match the actual value.
650
650
 
651
651
  ::read-more{icon="i-simple-icons-mdnwebdocs" to="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#description" target="_blank"}
652
652
  Learn more about `JSON.stringify` limitations.
@@ -4,14 +4,14 @@ description: Nuxt provides powerful state management libraries and the useState
4
4
  navigation.icon: i-lucide-database
5
5
  ---
6
6
 
7
- Nuxt provides the [`useState`](/docs/api/composables/use-state) composable to create a reactive and SSR-friendly shared state across components.
7
+ Nuxt provides the [`useState`](/docs/4.x/api/composables/use-state) composable to create a reactive and SSR-friendly shared state across components.
8
8
 
9
- [`useState`](/docs/api/composables/use-state) is an SSR-friendly [`ref`](https://vuejs.org/api/reactivity-core.html#ref) replacement. Its value will be preserved after server-side rendering (during client-side hydration) and shared across all components using a unique key.
9
+ [`useState`](/docs/4.x/api/composables/use-state) is an SSR-friendly [`ref`](https://vuejs.org/api/reactivity-core.html#ref) replacement. Its value will be preserved after server-side rendering (during client-side hydration) and shared across all components using a unique key.
10
10
 
11
11
  :video-accordion{title="Watch a video from Alexander Lichter about why and when to use useState" videoId="mv0WcBABcIk"}
12
12
 
13
13
  ::important
14
- Because the data inside [`useState`](/docs/api/composables/use-state) will be serialized to JSON, it is important that it does not contain anything that cannot be serialized, such as classes, functions or symbols.
14
+ Because the data inside [`useState`](/docs/4.x/api/composables/use-state) will be serialized to JSON, it is important that it does not contain anything that cannot be serialized, such as classes, functions or symbols.
15
15
  ::
16
16
 
17
17
  ::read-more{to="/docs/api/composables/use-state"}
@@ -56,12 +56,12 @@ const counter = useState('counter', () => Math.round(Math.random() * 1000))
56
56
  :link-example{to="/docs/examples/features/state-management"}
57
57
 
58
58
  ::note
59
- To globally invalidate cached state, see [`clearNuxtState`](/docs/api/utils/clear-nuxt-state) util.
59
+ To globally invalidate cached state, see [`clearNuxtState`](/docs/4.x/api/utils/clear-nuxt-state) util.
60
60
  ::
61
61
 
62
62
  ### Initializing State
63
63
 
64
- Most of the time, you will want to initialize your state with data that resolves asynchronously. You can use the [`app.vue`](/docs/guide/directory-structure/app) component with the [`callOnce`](/docs/api/utils/call-once) util to do so.
64
+ Most of the time, you will want to initialize your state with data that resolves asynchronously. You can use the [`app.vue`](/docs/4.x/guide/directory-structure/app) component with the [`callOnce`](/docs/4.x/api/utils/call-once) util to do so.
65
65
 
66
66
  ```vue twoslash [app/app.vue]
67
67
  <script setup lang="ts">
@@ -191,7 +191,7 @@ const date = useLocaleDate(new Date('2016-10-26'))
191
191
 
192
192
  ## Shared State
193
193
 
194
- By using [auto-imported composables](/docs/guide/directory-structure/app/composables) we can define global type-safe states and import them across the app.
194
+ By using [auto-imported composables](/docs/4.x/guide/directory-structure/app/composables) we can define global type-safe states and import them across the app.
195
195
 
196
196
  ```ts twoslash [composables/states.ts]
197
197
  export const useColor = () => useState<string>('color', () => 'pink')
@@ -214,7 +214,7 @@ const color = useColor() // Same as useState('color')
214
214
 
215
215
  ## Using third-party libraries
216
216
 
217
- Nuxt **used to rely** on the Vuex library to provide global state management. If you are migrating from Nuxt 2, please head to [the migration guide](/docs/migration/configuration#vuex).
217
+ Nuxt **used to rely** on the Vuex library to provide global state management. If you are migrating from Nuxt 2, please head to [the migration guide](/docs/4.x/migration/configuration#vuex).
218
218
 
219
219
  Nuxt is not opinionated about state management, so feel free to choose the right solution for your needs. There are multiple integrations with the most popular state management libraries, including:
220
220
 
@@ -8,7 +8,7 @@ Nuxt is a full-stack framework, which means there are several sources of unpreve
8
8
 
9
9
  - Errors during the Vue rendering lifecycle (SSR & CSR)
10
10
  - Server and client startup errors (SSR + CSR)
11
- - Errors during Nitro server lifecycle ([`server/`](/docs/guide/directory-structure/server) directory)
11
+ - Errors during Nitro server lifecycle ([`server/`](/docs/4.x/guide/directory-structure/server) directory)
12
12
  - Errors downloading JS chunks
13
13
 
14
14
  ::tip
@@ -19,7 +19,7 @@ Nuxt is a full-stack framework, which means there are several sources of unpreve
19
19
 
20
20
  You can hook into Vue errors using [`onErrorCaptured`](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured).
21
21
 
22
- In addition, Nuxt provides a [`vue:error`](/docs/api/advanced/hooks#app-hooks-runtime) hook that will be called if any errors propagate up to the top level.
22
+ In addition, Nuxt provides a [`vue:error`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook that will be called if any errors propagate up to the top level.
23
23
 
24
24
  If you are using an error reporting framework, you can provide a global handler through [`vueApp.config.errorHandler`](https://vuejs.org/api/application.html#app-config-errorhandler). It will receive all Vue errors, even if they are handled.
25
25
 
@@ -45,7 +45,7 @@ Note that the `vue:error` hook is based on [`onErrorCaptured`](https://vuejs.org
45
45
  Nuxt will call the `app:error` hook if there are any errors in starting your Nuxt application.
46
46
 
47
47
  This includes:
48
- - running [Nuxt plugins](/docs/guide/directory-structure/plugins)
48
+ - running [Nuxt plugins](/docs/4.x/guide/directory-structure/plugins)
49
49
  - processing `app:created` and `app:beforeMount` hooks
50
50
  - rendering your Vue app to HTML (during SSR)
51
51
  - mounting the app (on client-side), though you should handle this case with `onErrorCaptured` or with `vue:error`
@@ -53,7 +53,7 @@ This includes:
53
53
 
54
54
  ## Nitro Server Errors
55
55
 
56
- You cannot currently define a server-side handler for these errors, but can render an error page, see the [Render an Error Page](#error-page) section.
56
+ You cannot currently define a server-side handler for these errors, but can render an error page, see the [Render an Error Page](/docs/getting-started/error-handling#error-page) section.
57
57
 
58
58
  ## Errors with JS Chunks
59
59
 
@@ -119,14 +119,14 @@ export default defineNuxtPlugin(nuxtApp => {
119
119
  })
120
120
  ```
121
121
 
122
- When you are ready to remove the error page, you can call the [`clearError`](/docs/api/utils/clear-error) helper function, which takes an optional path to redirect to (for example, if you want to navigate to a 'safe' page).
122
+ When you are ready to remove the error page, you can call the [`clearError`](/docs/4.x/api/utils/clear-error) helper function, which takes an optional path to redirect to (for example, if you want to navigate to a 'safe' page).
123
123
 
124
124
  ::important
125
125
  Make sure to check before using anything dependent on Nuxt plugins, such as `$route` or `useRouter`, as if a plugin threw an error, then it won't be re-run until you clear the error.
126
126
  ::
127
127
 
128
128
  ::note
129
- Rendering an error page is an entirely separate page load, meaning any registered middleware will run again. You can use [`useError`](#useerror) in middleware to check if an error is being handled.
129
+ Rendering an error page is an entirely separate page load, meaning any registered middleware will run again. You can use [`useError`](/docs/getting-started/error-handling#useerror) in middleware to check if an error is being handled.
130
130
  ::
131
131
 
132
132
  ::note
@@ -156,7 +156,7 @@ function createError (err: string | { cause, data, message, name, stack, statusC
156
156
  Create an error object with additional metadata. You can pass a string to be set as the error `message` or an object containing error properties. It is usable in both the Vue and Server portions of your app, and is meant to be thrown.
157
157
 
158
158
  If you throw an error created with `createError`:
159
- - on server-side, it will trigger a full-screen error page which you can clear with [`clearError`](#clearerror).
159
+ - on server-side, it will trigger a full-screen error page which you can clear with [`clearError`](/docs/getting-started/error-handling#clearerror).
160
160
  - on client-side, it will throw a non-fatal error for you to handle. If you need to trigger a full-screen error page, then you can do this by setting `fatal: true`.
161
161
 
162
162
  ```vue twoslash [pages/movies/[slug\\].vue]
@@ -183,7 +183,7 @@ Read more about `createError` util.
183
183
  function showError (err: string | Error | { statusCode, statusMessage }): Error
184
184
  ```
185
185
 
186
- You can call this function at any point on client-side, or (on server side) directly within middleware, plugins or `setup()` functions. It will trigger a full-screen error page which you can clear with [`clearError`](#clearerror).
186
+ You can call this function at any point on client-side, or (on server side) directly within middleware, plugins or `setup()` functions. It will trigger a full-screen error page which you can clear with [`clearError`](/docs/getting-started/error-handling#clearerror).
187
187
 
188
188
  It is recommended instead to use `throw createError()`.
189
189
 
@@ -205,7 +205,7 @@ Read more about `clearError` util.
205
205
 
206
206
  ## Render Error in Component
207
207
 
208
- Nuxt also provides a [`<NuxtErrorBoundary>`](/docs/api/components/nuxt-error-boundary) component that allows you to handle client-side errors within your app, without replacing your entire site with an error page.
208
+ Nuxt also provides a [`<NuxtErrorBoundary>`](/docs/4.x/api/components/nuxt-error-boundary) component that allows you to handle client-side errors within your app, without replacing your entire site with an error page.
209
209
 
210
210
  This component is responsible for handling errors that occur within its default slot. On client-side, it will prevent the error from bubbling up to the top level, and will render the `#error` slot instead.
211
211
 
@@ -9,8 +9,8 @@ One of the core features of Nuxt is the layers and extending support. You can ex
9
9
  ## Use Cases
10
10
 
11
11
  - Share reusable configuration presets across projects using `nuxt.config` and `app.config`
12
- - Create a component library using [`app/components/`](/docs/guide/directory-structure/app/components) directory
13
- - Create utility and composable library using [`app/composables/`](/docs/guide/directory-structure/app/composables) and [`app/utils/`](/docs/guide/directory-structure/app/utils) directories
12
+ - Create a component library using [`app/components/`](/docs/4.x/guide/directory-structure/app/components) directory
13
+ - Create utility and composable library using [`app/composables/`](/docs/4.x/guide/directory-structure/app/composables) and [`app/utils/`](/docs/4.x/guide/directory-structure/app/utils) directories
14
14
  - Create Nuxt module presets
15
15
  - Share standard setup across projects
16
16
  - Create Nuxt themes
@@ -30,7 +30,7 @@ In addition, named layer aliases to the `srcDir` of each of these layers will au
30
30
  Named layer aliases were introduced in Nuxt v3.16.0.
31
31
  ::
32
32
 
33
- In addition, you can extend from a layer by adding the [extends](/docs/api/nuxt-config#extends) property to your [`nuxt.config`](/docs/guide/directory-structure/nuxt-config) file.
33
+ In addition, you can extend from a layer by adding the [extends](/docs/4.x/api/nuxt-config#extends) property to your [`nuxt.config`](/docs/4.x/guide/directory-structure/nuxt-config) file.
34
34
 
35
35
  ```ts [nuxt.config.ts]
36
36
  export default defineNuxtConfig({
@@ -10,7 +10,7 @@ Nuxt allows for select pages from your application to be rendered at build time.
10
10
 
11
11
  ## Crawl-based Pre-rendering
12
12
 
13
- Use the [`nuxt generate` command](/docs/api/commands/generate) to build and pre-render your application using the [Nitro](/docs/guide/concepts/server-engine) crawler. This command is similar to `nuxt build` with the `nitro.static` option set to `true`, or running `nuxt build --prerender`.
13
+ Use the [`nuxt generate` command](/docs/4.x/api/commands/generate) to build and pre-render your application using the [Nitro](/docs/4.x/guide/concepts/server-engine) crawler. This command is similar to `nuxt build` with the `nitro.static` option set to `true`, or running `nuxt build --prerender`.
14
14
 
15
15
  This will build your site, stand up a nuxt instance, and, by default, prerender the root page `/` along with any of your site's pages it links to, any of your site's pages they link to, and so on.
16
16
 
@@ -51,7 +51,7 @@ Read more about the `nuxt generate` command.
51
51
 
52
52
  ### Selective Pre-rendering
53
53
 
54
- You can manually specify routes that [Nitro](/docs/guide/concepts/server-engine) will fetch and pre-render during the build or ignore routes that you don't want to pre-render like `/dynamic` in the `nuxt.config` file:
54
+ You can manually specify routes that [Nitro](/docs/4.x/guide/concepts/server-engine) will fetch and pre-render during the build or ignore routes that you don't want to pre-render like `/dynamic` in the `nuxt.config` file:
55
55
 
56
56
  ```ts twoslash [nuxt.config.ts]
57
57
  export default defineNuxtConfig({
@@ -103,7 +103,7 @@ export default defineNuxtConfig({
103
103
  Read more about Nitro's `routeRules` configuration.
104
104
  ::
105
105
 
106
- As a shorthand, you can also configure this in a page file using [`defineRouteRules`](/docs/api/utils/define-route-rules).
106
+ As a shorthand, you can also configure this in a page file using [`defineRouteRules`](/docs/4.x/api/utils/define-route-rules).
107
107
 
108
108
  ::read-more{to="/docs/guide/going-further/experimental-features#inlinerouterules" icon="i-lucide-star"}
109
109
  This feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your `nuxt.config`.
@@ -139,7 +139,7 @@ export default defineNuxtConfig({
139
139
 
140
140
  ### `prerenderRoutes`
141
141
 
142
- You can use this at runtime within a [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context) to add more routes for Nitro to prerender.
142
+ You can use this at runtime within a [Nuxt context](/docs/4.x/guide/going-further/nuxt-app#the-nuxt-context) to add more routes for Nitro to prerender.
143
143
 
144
144
  ```vue [app/pages/index.vue]
145
145
  <script setup>
@@ -71,7 +71,7 @@ By default, the workload gets distributed to the workers with the round robin st
71
71
  There are two ways to deploy a Nuxt application to any static hosting services:
72
72
 
73
73
  - Static site generation (SSG) with `ssr: true` pre-renders routes of your application at build time. (This is the default behavior when running `nuxt generate`.) It will also generate `/200.html` and `/404.html` single-page app fallback pages, which can render dynamic routes or 404 errors on the client (though you may need to configure this on your static host).
74
- - Alternatively, you can prerender your site with `ssr: false` (static single-page app). This will produce HTML pages with an empty `<div id="__nuxt"></div>` where your Vue app would normally be rendered. You will lose many SEO benefits of prerendering your site, so it is suggested instead to use [`<ClientOnly>`](/docs/api/components/client-only) to wrap the portions of your site that cannot be server rendered (if any).
74
+ - Alternatively, you can prerender your site with `ssr: false` (static single-page app). This will produce HTML pages with an empty `<div id="__nuxt"></div>` where your Vue app would normally be rendered. You will lose many SEO benefits of prerendering your site, so it is suggested instead to use [`<ClientOnly>`](/docs/4.x/api/components/client-only) to wrap the portions of your site that cannot be server rendered (if any).
75
75
 
76
76
  :read-more{title="Nuxt prerendering" to="/docs/getting-started/prerendering"}
77
77
 
@@ -95,7 +95,7 @@ Nuxt can be deployed to several cloud providers with a minimal amount of configu
95
95
 
96
96
  In addition to Node.js servers and static hosting services, a Nuxt project can be deployed with several well-tested presets and minimal amount of configuration.
97
97
 
98
- You can explicitly set the desired preset in the [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file:
98
+ You can explicitly set the desired preset in the [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file:
99
99
 
100
100
  ```js twoslash [nuxt.config.ts]
101
101
  export default defineNuxtConfig({
@@ -5,7 +5,7 @@ navigation.icon: i-lucide-circle-check
5
5
  ---
6
6
 
7
7
  ::tip
8
- If you are a module author, you can find more specific information in the [Module Author's guide](/docs/guide/going-further/modules#testing).
8
+ If you are a module author, you can find more specific information in the [Module Author's guide](/docs/4.x/guide/going-further/modules#testing).
9
9
  ::
10
10
 
11
11
  Nuxt offers first-class support for end-to-end and unit testing of your Nuxt application via `@nuxt/test-utils`, a library of test utilities and configuration that currently powers the [tests we use on Nuxt itself](https://github.com/nuxt/nuxt/tree/main/test) and tests throughout the module ecosystem.
@@ -437,7 +437,7 @@ registerEndpoint('/test/', {
437
437
  })
438
438
  ```
439
439
 
440
- > **Note**: If your requests in a component go to an external API, you can use `baseURL` and then make it empty using [Nuxt Environment Override Config](/docs/getting-started/configuration#environment-overrides) (`$test`) so all your requests will go to Nitro server.
440
+ > **Note**: If your requests in a component go to an external API, you can use `baseURL` and then make it empty using [Nuxt Environment Override Config](/docs/4.x/getting-started/configuration#environment-overrides) (`$test`) so all your requests will go to Nitro server.
441
441
 
442
442
  #### Conflict with End-To-End Testing
443
443
 
@@ -624,7 +624,7 @@ Please use the options below for the `setup` method.
624
624
  - Type: `number | undefined`
625
625
  - Default: `undefined`
626
626
 
627
- - `host`: If provided, a URL to use as the test target instead of building and running a new server. Useful for running "real" end-to-end tests against a deployed version of your application, or against an already running local server (which may provide a significant reduction in test execution timings). See the [target host end-to-end example below](#target-host-end-to-end-example).
627
+ - `host`: If provided, a URL to use as the test target instead of building and running a new server. Useful for running "real" end-to-end tests against a deployed version of your application, or against an already running local server (which may provide a significant reduction in test execution timings). See the [target host end-to-end example below](/docs/getting-started/testing#target-host-end-to-end-example).
628
628
  - Type: `string`
629
629
  - Default: `undefined`
630
630
 
@@ -32,7 +32,7 @@ bun x nuxt upgrade
32
32
 
33
33
  ### Nightly Release Channel
34
34
 
35
- To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/guide/going-further/nightly-release-channel) guide.
35
+ To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/4.x/guide/going-further/nightly-release-channel) guide.
36
36
 
37
37
  ## Migrating to Nuxt 4
38
38
 
@@ -271,7 +271,7 @@ export default defineNuxtConfig({
271
271
 
272
272
  #### What Changed
273
273
 
274
- The order in which modules are loaded when using [Nuxt layers](/docs/guide/going-further/layers) has been corrected. Previously, modules from the project root were loaded before modules from extended layers, which was the reverse of the expected behavior.
274
+ The order in which modules are loaded when using [Nuxt layers](/docs/4.x/guide/going-further/layers) has been corrected. Previously, modules from the project root were loaded before modules from extended layers, which was the reverse of the expected behavior.
275
275
 
276
276
  Now modules are loaded in the correct order:
277
277
 
@@ -319,7 +319,7 @@ export default defineNuxtConfig({
319
319
  // 4. project-module-2 (can override layer modules)
320
320
  ```
321
321
 
322
- If you encounter issues with module order dependencies due to needing to register a hook, consider using the [`modules:done` hook](/docs/guide/going-further/modules#custom-hooks) for modules that need to call a hook. This is run after all other modules have been loaded, which means it is safe to use.
322
+ If you encounter issues with module order dependencies due to needing to register a hook, consider using the [`modules:done` hook](/docs/4.x/guide/going-further/modules#custom-hooks) for modules that need to call a hook. This is run after all other modules have been loaded, which means it is safe to use.
323
323
 
324
324
  👉 See [PR #31507](https://github.com/nuxt/nuxt/pull/31507) and [issue #25719](https://github.com/nuxt/nuxt/issues/25719) for more details.
325
325
 
@@ -11,25 +11,25 @@ const count = ref(1) // ref is auto-imported
11
11
  </script>
12
12
  ```
13
13
 
14
- Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/guide/directory-structure/app/components), [`app/composables/`](/docs/guide/directory-structure/app/composables) and [`app/utils/`](/docs/guide/directory-structure/app/utils).
14
+ Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/4.x/guide/directory-structure/app/components), [`app/composables/`](/docs/4.x/guide/directory-structure/app/composables) and [`app/utils/`](/docs/4.x/guide/directory-structure/app/utils).
15
15
 
16
16
  Contrary to a classic global declaration, Nuxt preserves typings, IDEs completions and hints, and **only includes what is used in your production code**.
17
17
 
18
18
  ::note
19
- In the docs, every function that is not explicitly imported is auto-imported by Nuxt and can be used as-is in your code. You can find a reference for auto-imported components, composables and utilities in the [API section](/docs/api).
19
+ In the docs, every function that is not explicitly imported is auto-imported by Nuxt and can be used as-is in your code. You can find a reference for auto-imported components, composables and utilities in the [API section](/docs/4.x/api).
20
20
  ::
21
21
 
22
22
  ::note
23
- In the [`server`](/docs/guide/directory-structure/server) directory, Nuxt auto-imports exported functions and variables from `server/utils/`.
23
+ In the [`server`](/docs/4.x/guide/directory-structure/server) directory, Nuxt auto-imports exported functions and variables from `server/utils/`.
24
24
  ::
25
25
 
26
26
  ::note
27
- You can also auto-import functions exported from custom folders or third-party packages by configuring the [`imports`](/docs/api/nuxt-config#imports) section of your `nuxt.config` file.
27
+ You can also auto-import functions exported from custom folders or third-party packages by configuring the [`imports`](/docs/4.x/api/nuxt-config#imports) section of your `nuxt.config` file.
28
28
  ::
29
29
 
30
30
  ## Built-in Auto-imports
31
31
 
32
- Nuxt auto-imports functions and composables to perform [data fetching](/docs/getting-started/data-fetching), get access to the [app context](/docs/api/composables/use-nuxt-app) and [runtime config](/docs/guide/going-further/runtime-config), manage [state](/docs/getting-started/state-management) or define components and plugins.
32
+ Nuxt auto-imports functions and composables to perform [data fetching](/docs/4.x/getting-started/data-fetching), get access to the [app context](/docs/4.x/api/composables/use-nuxt-app) and [runtime config](/docs/4.x/guide/going-further/runtime-config), manage [state](/docs/4.x/getting-started/state-management) or define components and plugins.
33
33
 
34
34
  ```vue twoslash
35
35
  <script setup lang="ts">
@@ -101,8 +101,8 @@ export const useMyComposable = () => {
101
101
 
102
102
  Nuxt directly auto-imports files created in defined directories:
103
103
 
104
- - `app/components/` for [Vue components](/docs/guide/directory-structure/app/components).
105
- - `app/composables/` for [Vue composables](/docs/guide/directory-structure/app/composables).
104
+ - `app/components/` for [Vue components](/docs/4.x/guide/directory-structure/app/components).
105
+ - `app/composables/` for [Vue composables](/docs/4.x/guide/directory-structure/app/composables).
106
106
  - `app/utils/` for helper functions and other utilities.
107
107
 
108
108
  :link-example{to="/docs/examples/features/auto-imports"}
@@ -139,7 +139,7 @@ export default defineNuxtConfig({
139
139
  })
140
140
  ```
141
141
 
142
- This will disable auto-imports completely but it's still possible to use [explicit imports](#explicit-imports) from `#imports`.
142
+ This will disable auto-imports completely but it's still possible to use [explicit imports](/docs/guide/concepts/auto-imports#explicit-imports) from `#imports`.
143
143
 
144
144
  ### Partially Disabling Auto-imports
145
145