@nuxt/docs-nightly 4.5.1-29752449.30d24817 → 4.5.2-2610052030-052d82e

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 (214) hide show
  1. package/1.getting-started/01.introduction.md +8 -8
  2. package/1.getting-started/02.installation.md +2 -4
  3. package/1.getting-started/03.configuration.md +16 -16
  4. package/1.getting-started/04.views.md +8 -8
  5. package/1.getting-started/05.assets.md +10 -10
  6. package/1.getting-started/06.styling.md +10 -10
  7. package/1.getting-started/07.routing.md +15 -15
  8. package/1.getting-started/08.seo-meta.md +15 -15
  9. package/1.getting-started/09.transitions.md +10 -10
  10. package/1.getting-started/10.data-fetching.md +61 -47
  11. package/1.getting-started/11.state-management.md +11 -11
  12. package/1.getting-started/12.error-handling.md +20 -18
  13. package/1.getting-started/13.server.md +7 -7
  14. package/1.getting-started/14.layers.md +6 -6
  15. package/1.getting-started/15.prerendering.md +22 -28
  16. package/1.getting-started/16.deployment.md +22 -6
  17. package/1.getting-started/17.testing.md +200 -21
  18. package/1.getting-started/18.upgrade.md +78 -278
  19. package/2.directory-structure/0.nuxt.md +2 -2
  20. package/2.directory-structure/0.output.md +3 -3
  21. package/2.directory-structure/1.app/1.assets.md +3 -3
  22. package/2.directory-structure/1.app/1.components.md +26 -109
  23. package/2.directory-structure/1.app/1.composables.md +5 -5
  24. package/2.directory-structure/1.app/1.layouts.md +10 -10
  25. package/2.directory-structure/1.app/1.middleware.md +14 -10
  26. package/2.directory-structure/1.app/1.pages.md +25 -20
  27. package/2.directory-structure/1.app/1.plugins.md +7 -7
  28. package/2.directory-structure/1.app/1.utils.md +9 -5
  29. package/2.directory-structure/1.app/3.app-config.md +7 -7
  30. package/2.directory-structure/1.app/3.app.md +6 -6
  31. package/2.directory-structure/1.app/3.error.md +1 -1
  32. package/2.directory-structure/1.content.md +1 -1
  33. package/2.directory-structure/1.layers.md +13 -13
  34. package/2.directory-structure/1.modules.md +3 -3
  35. package/2.directory-structure/1.node_modules.md +1 -1
  36. package/2.directory-structure/1.server.md +33 -14
  37. package/2.directory-structure/1.shared.md +7 -5
  38. package/2.directory-structure/1.test.md +25 -0
  39. package/2.directory-structure/2.env.md +7 -7
  40. package/2.directory-structure/2.nuxtignore.md +3 -3
  41. package/2.directory-structure/2.nuxtrc.md +3 -3
  42. package/2.directory-structure/3.nuxt-config.md +2 -2
  43. package/2.directory-structure/3.tsconfig.md +21 -11
  44. package/2.directory-structure/index.md +29 -25
  45. package/3.guide/0.index.md +6 -6
  46. package/3.guide/1.concepts/1.rendering.md +76 -12
  47. package/3.guide/1.concepts/10.vuejs-development.md +73 -8
  48. package/3.guide/1.concepts/2.nuxt-lifecycle.md +18 -18
  49. package/3.guide/1.concepts/3.auto-imports.md +11 -11
  50. package/3.guide/1.concepts/4.server-engine.md +6 -6
  51. package/3.guide/1.concepts/5.modules.md +4 -4
  52. package/3.guide/1.concepts/6.server-components.md +198 -0
  53. package/3.guide/1.concepts/7.esm.md +5 -5
  54. package/3.guide/1.concepts/8.typescript.md +9 -9
  55. package/3.guide/2.best-practices/accessibility.md +155 -0
  56. package/3.guide/2.best-practices/hydration.md +5 -5
  57. package/3.guide/2.best-practices/performance.md +13 -9
  58. package/3.guide/3.ai/1.mcp.md +104 -19
  59. package/3.guide/4.modules/2.module-anatomy.md +5 -5
  60. package/3.guide/4.modules/3.recipes-basics.md +8 -8
  61. package/3.guide/4.modules/4.module-dependencies.md +1 -1
  62. package/3.guide/4.modules/5.recipes-advanced.md +6 -8
  63. package/3.guide/4.modules/6.testing.md +2 -2
  64. package/3.guide/4.modules/7.best-practices.md +2 -2
  65. package/3.guide/4.modules/9.server-compatibility.md +215 -0
  66. package/3.guide/4.modules/index.md +9 -9
  67. package/3.guide/5.recipes/1.custom-routing.md +15 -11
  68. package/3.guide/5.recipes/2.vite-plugin.md +3 -3
  69. package/3.guide/5.recipes/3.custom-usefetch.md +5 -5
  70. package/3.guide/5.recipes/4.sessions-and-authentication.md +2 -2
  71. package/3.guide/5.recipes/5.mostly-static-sites.md +127 -0
  72. package/3.guide/6.going-further/1.events.md +1 -1
  73. package/3.guide/6.going-further/1.experimental-features.md +254 -22
  74. package/3.guide/6.going-further/1.features.md +42 -6
  75. package/3.guide/6.going-further/1.internals.md +10 -10
  76. package/3.guide/6.going-further/10.runtime-config.md +28 -6
  77. package/3.guide/6.going-further/11.nightly-release-channel.md +1 -1
  78. package/3.guide/6.going-further/2.hooks.md +6 -6
  79. package/3.guide/6.going-further/4.kit.md +4 -4
  80. package/3.guide/6.going-further/5.server-imports.md +221 -0
  81. package/3.guide/6.going-further/6.nuxt-app.md +7 -7
  82. package/3.guide/6.going-further/7.layers.md +13 -13
  83. package/3.guide/6.going-further/8.builders.md +38 -14
  84. package/4.api/1.components/1.nuxt-client-fallback.md +1 -1
  85. package/4.api/1.components/10.nuxt-picture.md +1 -1
  86. package/4.api/1.components/11.teleports.md +1 -1
  87. package/4.api/1.components/12.nuxt-route-announcer.md +5 -3
  88. package/4.api/1.components/14.nuxt-announcer.md +3 -3
  89. package/4.api/1.components/2.nuxt-page.md +5 -5
  90. package/4.api/1.components/3.nuxt-layout.md +8 -8
  91. package/4.api/1.components/4.nuxt-link.md +6 -4
  92. package/4.api/1.components/5.nuxt-loading-indicator.md +3 -3
  93. package/4.api/1.components/6.nuxt-error-boundary.md +1 -1
  94. package/4.api/1.components/8.nuxt-island.md +5 -5
  95. package/4.api/2.composables/create-use-async-data.md +51 -8
  96. package/4.api/2.composables/create-use-fetch.md +126 -9
  97. package/4.api/2.composables/use-announcer.md +3 -3
  98. package/4.api/2.composables/use-app-config.md +1 -1
  99. package/4.api/2.composables/use-async-data.md +19 -11
  100. package/4.api/2.composables/use-cookie.md +22 -6
  101. package/4.api/2.composables/use-error.md +1 -1
  102. package/4.api/2.composables/use-fetch.md +14 -10
  103. package/4.api/2.composables/use-head-safe.md +2 -2
  104. package/4.api/2.composables/use-head.md +2 -2
  105. package/4.api/2.composables/use-hydration.md +1 -1
  106. package/4.api/2.composables/use-layout.md +1 -1
  107. package/4.api/2.composables/use-lazy-async-data.md +8 -8
  108. package/4.api/2.composables/use-lazy-fetch.md +11 -11
  109. package/4.api/2.composables/use-loading-indicator.md +2 -2
  110. package/4.api/2.composables/use-nuxt-app.md +13 -13
  111. package/4.api/2.composables/use-nuxt-data.md +1 -1
  112. package/4.api/2.composables/use-preview-mode.md +3 -3
  113. package/4.api/2.composables/use-request-event.md +29 -3
  114. package/4.api/2.composables/use-request-fetch.md +2 -2
  115. package/4.api/2.composables/use-request-header.md +1 -1
  116. package/4.api/2.composables/use-request-headers.md +1 -1
  117. package/4.api/2.composables/use-request-url.md +1 -1
  118. package/4.api/2.composables/use-response-header.md +2 -2
  119. package/4.api/2.composables/use-route-announcer.md +4 -2
  120. package/4.api/2.composables/use-route.md +2 -2
  121. package/4.api/2.composables/use-router.md +5 -5
  122. package/4.api/2.composables/use-runtime-config.md +5 -5
  123. package/4.api/2.composables/use-runtime-hook.md +1 -1
  124. package/4.api/2.composables/use-seo-meta.md +3 -3
  125. package/4.api/2.composables/use-server-seo-meta.md +5 -5
  126. package/4.api/2.composables/use-state.md +4 -4
  127. package/4.api/3.utils/$fetch.md +5 -5
  128. package/4.api/3.utils/abort-navigation.md +1 -1
  129. package/4.api/3.utils/add-route-middleware.md +2 -2
  130. package/4.api/3.utils/call-once.md +3 -3
  131. package/4.api/3.utils/clear-error.md +2 -2
  132. package/4.api/3.utils/clear-nuxt-data.md +1 -1
  133. package/4.api/3.utils/clear-nuxt-state.md +2 -2
  134. package/4.api/3.utils/create-error.md +19 -1
  135. package/4.api/3.utils/define-nuxt-plugin.md +2 -2
  136. package/4.api/3.utils/define-nuxt-route-middleware.md +3 -3
  137. package/4.api/3.utils/define-page-meta.md +12 -12
  138. package/4.api/3.utils/define-route-rules.md +4 -4
  139. package/4.api/3.utils/define-use-async-data-addon.md +57 -0
  140. package/4.api/3.utils/define-use-fetch-addon.md +168 -0
  141. package/4.api/3.utils/navigate-to.md +6 -2
  142. package/4.api/3.utils/prefetch-components.md +1 -1
  143. package/4.api/3.utils/preload-route-components.md +2 -2
  144. package/4.api/3.utils/prerender-routes.md +3 -3
  145. package/4.api/3.utils/refresh-cookie.md +1 -1
  146. package/4.api/3.utils/refresh-nuxt-data.md +3 -3
  147. package/4.api/3.utils/reload-nuxt-app.md +1 -1
  148. package/4.api/3.utils/set-page-layout.md +1 -1
  149. package/4.api/3.utils/set-response-status.md +2 -2
  150. package/4.api/3.utils/show-error.md +3 -3
  151. package/4.api/3.utils/update-app-config.md +2 -2
  152. package/4.api/4.commands/README.md +9 -0
  153. package/4.api/5.kit/1.modules.md +3 -3
  154. package/4.api/5.kit/10.runtime-config.md +1 -1
  155. package/4.api/5.kit/10.templates.md +42 -0
  156. package/4.api/5.kit/12.nitro.md +59 -18
  157. package/4.api/5.kit/14.logging.md +56 -2
  158. package/4.api/5.kit/15.builder.md +1 -1
  159. package/4.api/5.kit/18.dependencies.md +90 -0
  160. package/4.api/5.kit/2.programmatic.md +78 -1
  161. package/4.api/5.kit/3.compatibility.md +2 -2
  162. package/4.api/5.kit/4.autoimports.md +13 -13
  163. package/4.api/5.kit/5.components.md +3 -3
  164. package/4.api/5.kit/6.context.md +2 -2
  165. package/4.api/5.kit/7.pages.md +35 -4
  166. package/4.api/5.kit/8.layout.md +1 -1
  167. package/4.api/6.advanced/1.hooks.md +6 -3
  168. package/4.api/6.nuxt-config.md +44 -21
  169. package/4.api/index.md +7 -7
  170. package/5.community/2.getting-help.md +1 -1
  171. package/5.community/3.reporting-bugs.md +1 -1
  172. package/5.community/4.contribution.md +14 -12
  173. package/5.community/5.framework-contribution.md +4 -4
  174. package/5.community/6.roadmap.md +6 -6
  175. package/6.bridge/1.overview.md +12 -12
  176. package/6.bridge/2.typescript.md +1 -1
  177. package/6.bridge/3.bridge-composition-api.md +6 -6
  178. package/6.bridge/4.plugins-and-middleware.md +4 -4
  179. package/6.bridge/5.nuxt3-compatible-api.md +9 -9
  180. package/6.bridge/6.meta.md +5 -5
  181. package/6.bridge/7.runtime-config.md +1 -1
  182. package/6.bridge/8.nitro.md +1 -1
  183. package/6.bridge/9.vite.md +1 -1
  184. package/7.migration/1.overview.md +2 -2
  185. package/7.migration/10.bundling.md +1 -1
  186. package/7.migration/11.server.md +3 -3
  187. package/7.migration/2.configuration.md +6 -6
  188. package/7.migration/20.module-authors.md +7 -7
  189. package/7.migration/3.auto-imports.md +3 -3
  190. package/7.migration/4.meta.md +4 -4
  191. package/7.migration/5.plugins-and-middleware.md +3 -3
  192. package/7.migration/6.pages-and-layouts.md +13 -13
  193. package/7.migration/7.component-options.md +15 -15
  194. package/7.migration/8.runtime-config.md +4 -4
  195. package/README.md +1 -1
  196. package/errors/e8007.md +28 -0
  197. package/package.json +2 -2
  198. package/4.api/4.commands/.navigation.yml +0 -3
  199. package/4.api/4.commands/add.md +0 -112
  200. package/4.api/4.commands/analyze.md +0 -42
  201. package/4.api/4.commands/build-module.md +0 -42
  202. package/4.api/4.commands/build.md +0 -48
  203. package/4.api/4.commands/cleanup.md +0 -38
  204. package/4.api/4.commands/dev.md +0 -61
  205. package/4.api/4.commands/devtools.md +0 -38
  206. package/4.api/4.commands/generate.md +0 -43
  207. package/4.api/4.commands/info.md +0 -33
  208. package/4.api/4.commands/init.md +0 -50
  209. package/4.api/4.commands/module.md +0 -84
  210. package/4.api/4.commands/prepare.md +0 -41
  211. package/4.api/4.commands/preview.md +0 -44
  212. package/4.api/4.commands/test.md +0 -40
  213. package/4.api/4.commands/typecheck.md +0 -44
  214. package/4.api/4.commands/upgrade.md +0 -37
@@ -44,6 +44,21 @@ If you have a component in nested directories such as:
44
44
  For clarity, we recommend that the component's filename matches its name. So, in the example above, you could rename `Button.vue` to be `BaseFooButton.vue`.
45
45
  ::
46
46
 
47
+ If you want to group components in a directory without affecting their name, you can use the parenthesis `(` `)` to name the grouping directory.
48
+
49
+ ```bash [Grouping Directory]
50
+ -| components/
51
+ ---| base/
52
+ -----| (foo)/
53
+ -------| Button.vue
54
+ ```
55
+
56
+ ... then the component's name will skip the grouping directory, resulting in:
57
+
58
+ ```html
59
+ <BaseButton />
60
+ ```
61
+
47
62
  If you want to auto-import components based only on its name, not path, then you need to set `pathPrefix` option to `false` using extended form of the configuration object:
48
63
 
49
64
  ```ts twoslash [nuxt.config.ts]
@@ -377,7 +392,7 @@ If `pattern` is specified, the `extensions` option has no effect, so make sure y
377
392
 
378
393
  ## npm Packages
379
394
 
380
- If you want to auto-import components from an npm package, you can use [`addComponent`](/docs/4.x/api/kit/components#addcomponent) in a [local module](/docs/4.x/directory-structure/modules) to register them.
395
+ If you want to auto-import components from an npm package, you can use [`addComponent`](/docs/api/kit/components#addcomponent) in a [local module](/docs/directory-structure/modules) to register them.
381
396
 
382
397
  ::code-group
383
398
 
@@ -409,7 +424,7 @@ export default defineNuxtModule({
409
424
 
410
425
  ## Component Extensions
411
426
 
412
- By default, any file with an extension specified in the [extensions key of `nuxt.config.ts`](/docs/4.x/api/nuxt-config#extensions) is treated as a component.
427
+ By default, any file with an extension specified in the [extensions key of `nuxt.config.ts`](/docs/api/nuxt-config#extensions) is treated as a component.
413
428
  If you need to restrict the file extensions that should be registered as components, you can use the extended form of the components directory declaration and its `extensions` key:
414
429
 
415
430
  ```ts twoslash [nuxt.config.ts]
@@ -449,7 +464,7 @@ This feature only works with Nuxt auto-imports and `#components` imports. Explic
449
464
  `.client` components are rendered only after being mounted. To access the rendered template using `onMounted()`, add `await nextTick()` in the callback of the `onMounted()` hook.
450
465
  ::
451
466
 
452
- ::read-more{to="/docs/4.x/api/components/client-only"}
467
+ ::read-more{to="/docs/api/components/client-only"}
453
468
  You can also achieve a similar result with the `<ClientOnly>` component.
454
469
  ::
455
470
 
@@ -457,7 +472,7 @@ You can also achieve a similar result with the `<ClientOnly>` component.
457
472
 
458
473
  Server components allow server-rendering individual components within your client-side apps. It's possible to use server components within Nuxt, even if you are generating a static site. That makes it possible to build complex sites that mix dynamic components, server-rendered HTML and even static chunks of markup.
459
474
 
460
- Server components can either be used on their own or paired with a [client component](/docs/4.x/directory-structure/app/components#paired-with-a-client-component).
475
+ Server components can either be used on their own or paired with a [client component](/docs/directory-structure/app/components#paired-with-a-client-component).
461
476
 
462
477
  :video-accordion{title="Watch Learn Vue video about Nuxt Server Components" videoId="u1yyXe86xJM"}
463
478
 
@@ -471,17 +486,7 @@ Standalone server components will always be rendered on the server, also known a
471
486
 
472
487
  When their props update, this will result in a network request that will update the rendered HTML in-place.
473
488
 
474
- Server components are currently experimental and in order to use them, you need to enable the 'component islands' feature in your nuxt.config:
475
-
476
- ```ts twoslash [nuxt.config.ts]
477
- export default defineNuxtConfig({
478
- experimental: {
479
- componentIslands: true,
480
- },
481
- })
482
- ```
483
-
484
- Now you can register server-only components with the `.server` suffix and use them anywhere in your application automatically.
489
+ Register server-only components with the `.server` suffix and use them anywhere in your application automatically.
485
490
 
486
491
  ```bash [Directory Structure]
487
492
  -| components/
@@ -500,102 +505,14 @@ Now you can register server-only components with the `.server` suffix and use th
500
505
  </template>
501
506
  ```
502
507
 
503
- Server-only components use [`<NuxtIsland>`](/docs/4.x/api/components/nuxt-island) under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to it.
508
+ Server-only components use [`<NuxtIsland>`](/docs/api/components/nuxt-island) under the hood, meaning that `lazy` prop and `#fallback` slot are both passed down to it.
504
509
 
505
510
  ::warning
506
511
  Server components (and islands) must have a single root element. (HTML comments are considered elements as well.)
507
512
  ::
508
513
 
509
- ::warning
510
- Props are passed to server components via URL query parameters, and are therefore limited by the possible length of a URL, so be careful not to pass enormous amounts of data to server components via props.
511
- ::
512
-
513
- ::note
514
- Server component props come from the request (URL query or body), so treat them as untrusted input. Nuxt rejects the props most likely to leak through unintentionally: a top-level `as` that the island does not declare (an undeclared prop falls through as an attribute onto the island's root), and, with `vue.runtimeCompiler` enabled, a `template` anywhere in the props. Beyond that, avoid feeding props you have not validated into dynamic component resolution (`<component :is>`{lang=vue}, `h()`, `resolveDynamicComponent()`, or a polymorphic `as` / `asChild` prop), since a string can resolve to any registered component or HTML element.
515
-
516
- Props a component does not declare fall through as attributes onto its single root element, so an island whose root is a polymorphic component (e.g. from `reka-ui` / `@nuxt/ui`) can receive attributes you did not bind. Set `defineOptions({ inheritAttrs: false })`{lang=ts} on such islands, or declare the props you accept.
517
-
518
- To switch components based on caller input, map a discriminator through an allowlist of imported components rather than passing the raw prop:
519
-
520
- ```vue
521
- <script setup lang="ts">
522
- import type { Component } from 'vue'
523
- import CardA from './CardA.vue'
524
- import CardB from './CardB.vue'
525
-
526
- const props = defineProps<{ variant: string }>()
527
- const allowed: Record<string, Component> = { a: CardA, b: CardB }
528
- const component = allowed[props.variant] ?? CardA
529
- </script>
530
-
531
- <template>
532
- <component :is="component" />
533
- </template>
534
- ```
535
- ::
536
-
537
- ::warning
538
- Be careful when nesting islands within other islands as each island adds some extra overhead.
539
- ::
540
-
541
- ::warning
542
- Most features for server-only components and island components, such as slots and client components, are only available for single file components.
543
- ::
544
-
545
- #### Client components within server components
546
-
547
- ::note
548
- This feature needs `experimental.componentIslands.selectiveClient` within your configuration to be true.
549
- ::
550
-
551
- You can partially hydrate a component by setting a `nuxt-client` attribute on the component you wish to be loaded client-side.
552
-
553
- ```vue [app/components/ServerWithClient.vue]
554
- <template>
555
- <div>
556
- <HighlightedMarkdown markdown="# Headline" />
557
- <!-- Counter will be loaded and hydrated client-side -->
558
- <Counter
559
- nuxt-client
560
- :count="5"
561
- />
562
- </div>
563
- </template>
564
- ```
565
-
566
- ::note
567
- This only works within a server component. Slots for client components are working only with `experimental.componentIsland.selectiveClient` set to `'deep'` and since they are rendered server-side, they are not interactive once client-side.
568
- ::
569
-
570
- ::warning
571
- Use `nuxt-client` only on local `.vue` SFCs. Built-ins like [`<NuxtLink>`](/docs/4.x/api/components/nuxt-link) skip the islands transform. After client navigation you may see `Failed to locate Teleport target`, or the link disappears with no error. Wrap the built-in in your own `.vue` file and put `nuxt-client` on that wrapper, or drop `nuxt-client` from the built-in. See [#29251](https://github.com/nuxt/nuxt/issues/29251) and [#26002](https://github.com/nuxt/nuxt/issues/26002).
572
- ::
573
-
574
- #### Server Component Context
575
-
576
- When rendering a server-only or island component, `<NuxtIsland>` makes a fetch request which comes back with a `NuxtIslandResponse`. (This is an internal request if rendered on the server, or a request that you can see in the network tab if it's rendering on client-side navigation.)
577
-
578
- This means:
579
-
580
- * A new Vue app will be created server-side to create the `NuxtIslandResponse`.
581
- * A new 'island context' will be created while rendering the component.
582
- * You can't access the 'island context' from the rest of your app and you can't access the context of the rest of your app from the island component. In other words, the server component or island is _isolated_ from the rest of your app.
583
- * Your plugins will run again when rendering the island, unless they have `env: { islands: false }` set (which you can do in an object-syntax plugin).
584
-
585
- ::important
586
- Route middleware does not run when rendering island components. Middleware is a routing concept that applies to pages, not components, and is not designed to control component rendering.
587
- ::
588
-
589
- ::important
590
- `useRoute()` and other `vue-router` composables do not track the current page route inside a server (island) component. The island is rendered in its own isolated Vue app keyed only on its props (and any explicit context), which is what keeps islands cacheable independently of the page they are rendered on. Inside an island, `useRoute()` will reflect the island's own request, not the page the user is on.
591
-
592
- If an island needs information about the current route, pass it in explicitly &mdash; either as props from the parent component, or via the `context` prop on `<NuxtIsland>` (read inside the island from `nuxtApp.ssrContext.islandContext`).
593
- ::
594
-
595
- Within an island component, you can access its island context through `nuxtApp.ssrContext.islandContext`. Note that while island components are still marked as experimental, the format of this context may change.
596
-
597
- ::note
598
- Slots can be interactive and are wrapped within a `<div>` with `display: contents;`
514
+ ::read-more{to="/docs/guide/concepts/server-components"}
515
+ Read more about how islands are rendered, the isolated island context, selective hydration with `nuxt-client`, slots, caching and current limitations in the dedicated server components guide.
599
516
  ::
600
517
 
601
518
  ### Paired with a Client component
@@ -621,14 +538,14 @@ In this case, the `.server` + `.client` components are two 'halves' of a compone
621
538
 
622
539
  There are a number of components that Nuxt provides, including `<ClientOnly>` and `<DevOnly>`. You can read more about them in the API documentation.
623
540
 
624
- ::read-more{to="/docs/4.x/api"}
541
+ ::read-more{to="/docs/api"}
625
542
  ::
626
543
 
627
544
  ## Library Authors
628
545
 
629
546
  Making Vue component libraries with automatic tree-shaking and component registration is super easy. ✨
630
547
 
631
- You can use the [`addComponentsDir`](/docs/4.x/api/kit/components#addcomponentsdir) method provided from the `@nuxt/kit` to register your components directory in your Nuxt module.
548
+ You can use the [`addComponentsDir`](/docs/api/kit/components#addcomponentsdir) method provided from the `@nuxt/kit` to register your components directory in your Nuxt module.
632
549
 
633
550
  Imagine a directory structure like this:
634
551
 
@@ -683,4 +600,4 @@ export default defineNuxtConfig({
683
600
 
684
601
  It will automatically import the components only if used and also support HMR when updating your components in `node_modules/awesome-ui/components/`.
685
602
 
686
- :link-example{to="/docs/4.x/examples/features/auto-imports"}
603
+ :link-example{to="/docs/examples/features/auto-imports"}
@@ -42,15 +42,15 @@ const foo = useFoo()
42
42
  The `app/composables/` directory in Nuxt does not provide any additional reactivity capabilities to your code. Instead, any reactivity within composables is achieved using Vue's Composition API mechanisms, such as ref and reactive. Note that reactive code is also not limited to the boundaries of the `app/composables/` directory. You are free to employ reactivity features wherever they're needed in your application.
43
43
  ::
44
44
 
45
- :read-more{to="/docs/4.x/guide/concepts/auto-imports"}
45
+ :read-more{to="/docs/guide/concepts/auto-imports"}
46
46
 
47
- :link-example{to="/docs/4.x/examples/features/auto-imports"}
47
+ :link-example{to="/docs/examples/features/auto-imports"}
48
48
 
49
49
  ## Types
50
50
 
51
51
  Under the hood, Nuxt auto generates the file `.nuxt/imports.d.ts` to declare the types.
52
52
 
53
- Be aware that you have to run [`nuxt prepare`](/docs/4.x/api/commands/prepare), [`nuxt dev`](/docs/4.x/api/commands/dev) or [`nuxt build`](/docs/4.x/api/commands/build) in order to let Nuxt generate the types.
53
+ Be aware that you have to run [`nuxt prepare`](/docs/api/commands/prepare), [`nuxt dev`](/docs/api/commands/dev) or [`nuxt build`](/docs/api/commands/build) in order to let Nuxt generate the types.
54
54
 
55
55
  ::note
56
56
  If you create a composable without having the dev server running, TypeScript will throw an error, such as `Cannot find name 'useBar'.`
@@ -71,7 +71,7 @@ export const useFoo = () => {
71
71
 
72
72
  ### Access Plugin Injections
73
73
 
74
- You can access [plugin injections](/docs/4.x/directory-structure/app/plugins#providing-helpers) from composables:
74
+ You can access [plugin injections](/docs/directory-structure/app/plugins#providing-helpers) from composables:
75
75
 
76
76
  ```ts [app/composables/test.ts]
77
77
  export const useHello = () => {
@@ -82,7 +82,7 @@ export const useHello = () => {
82
82
 
83
83
  ## How Files Are Scanned
84
84
 
85
- Nuxt only scans files at the top level of the [`app/composables/` directory](/docs/4.x/directory-structure/app/composables), e.g.:
85
+ Nuxt only scans files at the top level of the [`app/composables/` directory](/docs/directory-structure/app/composables), e.g.:
86
86
 
87
87
  ```bash [Directory Structure]
88
88
  -| composables/
@@ -11,7 +11,7 @@ For best performance, components placed in this directory will be automatically
11
11
 
12
12
  ## Enable Layouts
13
13
 
14
- Layouts are enabled by adding [`<NuxtLayout>`](/docs/4.x/api/components/nuxt-layout) to your [`app.vue`](/docs/4.x/directory-structure/app/app):
14
+ Layouts are enabled by adding [`<NuxtLayout>`](/docs/api/components/nuxt-layout) to your [`app.vue`](/docs/directory-structure/app/app):
15
15
 
16
16
  ```vue [app/app.vue]
17
17
  <template>
@@ -22,7 +22,7 @@ Layouts are enabled by adding [`<NuxtLayout>`](/docs/4.x/api/components/nuxt-lay
22
22
  ```
23
23
 
24
24
  To use a layout:
25
- - Set a `layout` property in your page with [definePageMeta](/docs/4.x/api/utils/define-page-meta).
25
+ - Set a `layout` property in your page with [definePageMeta](/docs/api/utils/define-page-meta).
26
26
  - Set the `name` prop of `<NuxtLayout>`.
27
27
  - Set the `appLayout` property in route rules.
28
28
 
@@ -35,7 +35,7 @@ If no layout is specified, `app/layouts/default.vue` will be used.
35
35
  ::
36
36
 
37
37
  ::important
38
- If you only have a single layout in your application, we recommend using [`app.vue`](/docs/4.x/directory-structure/app/app) instead.
38
+ If you only have a single layout in your application, we recommend using [`app.vue`](/docs/directory-structure/app/app) instead.
39
39
  ::
40
40
 
41
41
  ::important
@@ -81,11 +81,11 @@ definePageMeta({
81
81
  </script>
82
82
  ```
83
83
 
84
- ::read-more{to="/docs/4.x/directory-structure/app/pages#page-metadata"}
84
+ ::read-more{to="/docs/directory-structure/app/pages#page-metadata"}
85
85
  Learn more about `definePageMeta`.
86
86
  ::
87
87
 
88
- You can directly override the default layout for all pages using the `name` property of [`<NuxtLayout>`](/docs/4.x/api/components/nuxt-layout):
88
+ You can directly override the default layout for all pages using the `name` property of [`<NuxtLayout>`](/docs/api/components/nuxt-layout):
89
89
 
90
90
  ```vue [app/app.vue]
91
91
  <script setup lang="ts">
@@ -116,11 +116,11 @@ File | Layout Name
116
116
  `~/layouts/desktop-base/DesktopBase.vue` | `desktop-base`
117
117
  `~/layouts/desktop/Desktop.vue` | `desktop`
118
118
 
119
- :link-example{to="/docs/4.x/examples/features/layouts"}
119
+ :link-example{to="/docs/examples/features/layouts"}
120
120
 
121
121
  ## Changing the Layout Dynamically
122
122
 
123
- You can also use the [`setPageLayout`](/docs/4.x/api/utils/set-page-layout) helper to change the layout dynamically:
123
+ You can also use the [`setPageLayout`](/docs/api/utils/set-page-layout) helper to change the layout dynamically:
124
124
 
125
125
  ```vue twoslash [app/pages/index.vue]
126
126
  <script setup lang="ts">
@@ -166,7 +166,7 @@ export default defineNuxtConfig({
166
166
  This is useful when you want to manage layouts centrally in your configuration rather than in each page file, or when you need to apply layouts to routes that don't have corresponding page components (such as catchall pages which might match many paths).
167
167
  ::
168
168
 
169
- :link-example{to="/docs/4.x/examples/features/layouts"}
169
+ :link-example{to="/docs/examples/features/layouts"}
170
170
 
171
171
  ## Passing Props to Layouts :badge[+4.4]{color="primary" class="align-middle"}
172
172
 
@@ -221,7 +221,7 @@ Props are fully typed based on your layout's `defineProps`. You'll get autocompl
221
221
 
222
222
  ### Via `setPageLayout`
223
223
 
224
- You can also pass props when changing the layout dynamically with [`setPageLayout`](/docs/4.x/api/utils/set-page-layout):
224
+ You can also pass props when changing the layout dynamically with [`setPageLayout`](/docs/api/utils/set-page-layout):
225
225
 
226
226
  ```ts
227
227
  setPageLayout('panel', { sidebar: true, title: 'Dashboard' })
@@ -271,5 +271,5 @@ definePageMeta({
271
271
  ::
272
272
 
273
273
  ::important
274
- If you use `<NuxtLayout>` within your pages, make sure it is not the root element (or [disable layout/page transitions](/docs/4.x/getting-started/transitions#disable-transitions)).
274
+ If you use `<NuxtLayout>` within your pages, make sure it is not the root element (or [disable layout/page transitions](/docs/getting-started/transitions#disable-transitions)).
275
275
  ::
@@ -13,14 +13,18 @@ There are three kinds of route middleware:
13
13
  2. Named route middleware, placed in the `app/middleware/` and automatically loaded via asynchronous import when used on a page.
14
14
  3. Global route middleware, placed in the `app/middleware/` with a `.global` suffix and is run on every route change.
15
15
 
16
- The first two kinds of route middleware can be defined in [`definePageMeta`](/docs/4.x/api/utils/define-page-meta).
16
+ The first two kinds of route middleware can be defined in [`definePageMeta`](/docs/api/utils/define-page-meta).
17
17
 
18
18
  ::note
19
19
  Name of middleware are normalized to kebab-case: `myMiddleware` becomes `my-middleware`.
20
20
  ::
21
21
 
22
22
  ::note
23
- Route middleware run within the Vue part of your Nuxt app. Despite the similar name, they are completely different from [server middleware](/docs/4.x/directory-structure/server#server-middleware), which are run in the Nitro server part of your app.
23
+ Only files at the top level of the directory (or index files within any subdirectories) are registered. An index file takes its name from the folder that contains it: `middleware/auth/index.ts` is registered as `auth`.
24
+ ::
25
+
26
+ ::note
27
+ Route middleware run within the Vue part of your Nuxt app. Despite the similar name, they are completely different from [server middleware](/docs/directory-structure/server#server-middleware), which are run in the Nitro server part of your app.
24
28
  ::
25
29
 
26
30
  :video-accordion{title="Watch a video from Vue School on all 3 kinds of middleware" videoId="761471577" platform="vimeo"}
@@ -45,8 +49,8 @@ export default defineNuxtRouteMiddleware((to, from) => {
45
49
 
46
50
  Nuxt provides two globally available helpers that can be returned directly from the middleware.
47
51
 
48
- 1. [`navigateTo`](/docs/4.x/api/utils/navigate-to) - Redirects to the given route
49
- 2. [`abortNavigation`](/docs/4.x/api/utils/abort-navigation) - Aborts the navigation, with an optional error message.
52
+ 1. [`navigateTo`](/docs/api/utils/navigate-to) - Redirects to the given route
53
+ 2. [`abortNavigation`](/docs/api/utils/abort-navigation) - Aborts the navigation, with an optional error message.
50
54
 
51
55
  Unlike [navigation guards](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards) from `vue-router`, a third `next()` argument is not passed, and **redirect or route cancellation is handled by returning a value from the middleware**.
52
56
 
@@ -58,8 +62,8 @@ Possible return values are:
58
62
  * `return abortNavigation()` - stops the current navigation
59
63
  * `return abortNavigation(error)` - rejects the current navigation with an error
60
64
 
61
- :read-more{to="/docs/4.x/api/utils/navigate-to"}
62
- :read-more{to="/docs/4.x/api/utils/abort-navigation"}
65
+ :read-more{to="/docs/api/utils/navigate-to"}
66
+ :read-more{to="/docs/api/utils/abort-navigation"}
63
67
 
64
68
  ::important
65
69
  We recommend using the helper functions above for performing redirects or stopping navigation. Other possible return values described in [the vue-router docs](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards) may work but there may be breaking changes in future.
@@ -145,12 +149,12 @@ export default defineNuxtRouteMiddleware((to) => {
145
149
  This is true even if you throw an error in your middleware on the server, and an error page is rendered. The middleware will still run again in the browser.
146
150
 
147
151
  ::note
148
- Rendering an error page is an entirely separate page load, meaning any registered middleware will run again. You can use [`useError`](/docs/4.x/getting-started/error-handling#useerror) in middleware to check if an error is being handled.
152
+ 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.
149
153
  ::
150
154
 
151
155
  ## Accessing Route in Middleware
152
156
 
153
- Always use the `to` and `from` parameters in your middleware to access the next and previous routes. Avoid using the [`useRoute()`](/docs/4.x/api/composables/use-route) composable in this context altogether.
157
+ Always use the `to` and `from` parameters in your middleware to access the next and previous routes. Avoid using the [`useRoute()`](/docs/api/composables/use-route) composable in this context altogether.
154
158
  There is **no concept of a "current route" in middleware**, as middleware can abort a navigation or redirect to a different route. The `useRoute()` composable will always be inaccurate in this context.
155
159
 
156
160
  ::warning
@@ -188,7 +192,7 @@ export function callsRouteInternally () {
188
192
 
189
193
  ## Adding Middleware Dynamically
190
194
 
191
- It is possible to add global or named route middleware manually using the [`addRouteMiddleware()`](/docs/4.x/api/utils/add-route-middleware) helper function, such as from within a plugin.
195
+ It is possible to add global or named route middleware manually using the [`addRouteMiddleware()`](/docs/api/utils/add-route-middleware) helper function, such as from within a plugin.
192
196
 
193
197
  ```ts twoslash
194
198
  export default defineNuxtPlugin(() => {
@@ -222,7 +226,7 @@ definePageMeta({
222
226
 
223
227
  Now, before navigation to that page can complete, the `auth` route middleware will be run.
224
228
 
225
- :link-example{to="/docs/4.x/examples/routing/middleware"}
229
+ :link-example{to="/docs/examples/routing/middleware"}
226
230
 
227
231
  ## Setting Middleware at Build Time
228
232
 
@@ -6,17 +6,17 @@ navigation.icon: i-vscode-icons-folder-type-view
6
6
  ---
7
7
 
8
8
  ::note
9
- To reduce your application's bundle size, this directory is **optional**, meaning that [`vue-router`](https://router.vuejs.org) won't be included if you only use [`app.vue`](/docs/4.x/directory-structure/app/app). To force the pages system, set `pages: true` in `nuxt.config` or have a [`router.options.ts`](/docs/4.x/guide/recipes/custom-routing#using-routeroptions).
9
+ To reduce your application's bundle size, this directory is **optional**, meaning that [`vue-router`](https://router.vuejs.org) won't be included if you only use [`app.vue`](/docs/directory-structure/app/app). To force the pages system, set `pages: true` in `nuxt.config` or have a [`router.options.ts`](/docs/guide/recipes/custom-routing#using-routeroptions).
10
10
  ::
11
11
 
12
12
  ## Usage
13
13
 
14
- Pages are Vue components and can have any [valid extension](/docs/4.x/api/nuxt-config#extensions) that Nuxt supports (by default `.vue`, `.js`, `.jsx`, `.mjs`, `.ts` or `.tsx`).
14
+ Pages are Vue components and can have any [valid extension](/docs/api/nuxt-config#extensions) that Nuxt supports (by default `.vue`, `.js`, `.jsx`, `.mjs`, `.ts` or `.tsx`).
15
15
 
16
16
  Nuxt will automatically create a route for every page in your `~/pages/` directory.
17
17
 
18
18
  ::tip
19
- Pages are only automatically registered for prerendering if you have not disabled `nitro.prerender.crawlLinks` and you have at least one page in your `nitro.prerender.routes` list. See the [prerendering guide](/docs/4.x/getting-started/prerendering).
19
+ Pages are only automatically registered for prerendering if you have not disabled `prerender.crawlLinks` and you have at least one page in your `prerender.routes` list. See the [prerendering guide](/docs/getting-started/prerendering).
20
20
  ::
21
21
 
22
22
  ::code-group
@@ -37,7 +37,7 @@ export default defineComponent({
37
37
  ```
38
38
 
39
39
  ```tsx twoslash [pages/index.tsx]
40
- // https://nuxt.com/docs/4.x/examples/advanced/jsx
40
+ // /docs/examples/advanced/jsx
41
41
  // https://vuejs.org/guide/extras/render-function.html#jsx-tsx
42
42
  export default defineComponent({
43
43
  render () {
@@ -50,7 +50,7 @@ export default defineComponent({
50
50
 
51
51
  The `app/pages/index.vue` file will be mapped to the `/` route of your application.
52
52
 
53
- If you are using [`app.vue`](/docs/4.x/directory-structure/app/app), make sure to use the [`<NuxtPage/>`](/docs/4.x/api/components/nuxt-page) component to display the current page:
53
+ If you are using [`app.vue`](/docs/directory-structure/app/app), make sure to use the [`<NuxtPage/>`](/docs/api/components/nuxt-page) component to display the current page:
54
54
 
55
55
  ```vue [app/app.vue]
56
56
  <template>
@@ -61,7 +61,7 @@ If you are using [`app.vue`](/docs/4.x/directory-structure/app/app), make sure t
61
61
  </template>
62
62
  ```
63
63
 
64
- Pages **must have a single root element** to allow [route transitions](/docs/4.x/getting-started/transitions) between pages. HTML comments are considered elements as well.
64
+ Pages **must have a single root element** to allow [route transitions](/docs/getting-started/transitions) between pages. HTML comments are considered elements as well.
65
65
 
66
66
  This means that when the route is server-rendered, or statically generated, you will be able to see its contents correctly, but when you navigate towards that route during client-side navigation the transition between routes will fail and you'll see that the route will not be rendered.
67
67
 
@@ -122,7 +122,7 @@ Navigating to `/users-admins/123` would render:
122
122
  <p>admins - 123</p>
123
123
  ```
124
124
 
125
- If you want to access the route using Composition API, there is a global [`useRoute`](/docs/4.x/api/composables/use-route) function that will allow you to access the route just like `this.$route` in the Options API.
125
+ If you want to access the route using Composition API, there is a global [`useRoute`](/docs/api/composables/use-route) function that will allow you to access the route just like `this.$route` in the Options API.
126
126
 
127
127
  ```vue twoslash
128
128
  <script setup lang="ts">
@@ -232,7 +232,7 @@ definePageMeta({
232
232
  </script>
233
233
  ```
234
234
 
235
- :link-example{to="/docs/4.x/examples/routing/pages"}
235
+ :link-example{to="/docs/examples/routing/pages"}
236
236
 
237
237
  ## Named Views :badge[v4.5]{color="info" size="xs" class="align-middle"}
238
238
 
@@ -369,25 +369,25 @@ Nuxt will automatically wrap your page in [the Vue `<KeepAlive>` component](http
369
369
 
370
370
  When your goal is to preserve state for parent routes use this syntax: `<NuxtPage keepalive />`. You can also set props to be passed to `<KeepAlive>` (see [a full list](https://vuejs.org/api/built-in-components#keepalive)).
371
371
 
372
- You can set a default value for this property [in your `nuxt.config`](/docs/4.x/api/nuxt-config#keepalive).
372
+ You can set a default value for this property [in your `nuxt.config`](/docs/api/nuxt-config#keepalive).
373
373
 
374
374
  #### `key`
375
375
 
376
- [See above](/docs/4.x/directory-structure/app/pages#child-route-keys).
376
+ [See above](/docs/directory-structure/app/pages#child-route-keys).
377
377
 
378
378
  #### `layout`
379
379
 
380
- You can define the layout used to render the route. This can be either false (to disable any layout), a string or a ref/computed, if you want to make it reactive in some way. [More about layouts](/docs/4.x/directory-structure/app/layouts).
380
+ You can define the layout used to render the route. This can be either false (to disable any layout), a string or a ref/computed, if you want to make it reactive in some way. [More about layouts](/docs/directory-structure/app/layouts).
381
381
 
382
382
  #### `layoutTransition` and `pageTransition`
383
383
 
384
384
  You can define transition properties for the `<transition>` component that wraps your pages and layouts, or pass `false` to disable the `<transition>` wrapper for that route. You can see [a list of options that can be passed](https://vuejs.org/api/built-in-components#transition) or read [more about how transitions work](https://vuejs.org/guide/built-ins/transition#transition).
385
385
 
386
- You can set default values for these properties [in your `nuxt.config`](/docs/4.x/api/nuxt-config#layouttransition).
386
+ You can set default values for these properties [in your `nuxt.config`](/docs/api/nuxt-config#layouttransition).
387
387
 
388
388
  #### `middleware`
389
389
 
390
- You can define middleware to apply before loading this page. It will be merged with all the other middleware used in any matching parent/child routes. It can be a string, a function (an anonymous/inlined middleware function following [the global before guard pattern](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards)), or an array of strings/functions. [More about named middleware](/docs/4.x/directory-structure/app/middleware).
390
+ You can define middleware to apply before loading this page. It will be merged with all the other middleware used in any matching parent/child routes. It can be a string, a function (an anonymous/inlined middleware function following [the global before guard pattern](https://router.vuejs.org/guide/advanced/navigation-guards#Global-Before-Guards)), or an array of strings/functions. [More about named middleware](/docs/directory-structure/app/middleware).
391
391
 
392
392
  #### `name`
393
393
 
@@ -418,7 +418,7 @@ export {}
418
418
 
419
419
  ## Navigation
420
420
 
421
- To navigate between pages of your app, you should use the [`<NuxtLink>`](/docs/4.x/api/components/nuxt-link) component.
421
+ To navigate between pages of your app, you should use the [`<NuxtLink>`](/docs/api/components/nuxt-link) component.
422
422
 
423
423
  This component is included with Nuxt and therefore you don't have to import it as you do with other components.
424
424
 
@@ -430,7 +430,7 @@ A simple link to the `index.vue` page in your `app/pages` folder:
430
430
  </template>
431
431
  ```
432
432
 
433
- ::read-more{to="/docs/4.x/api/components/nuxt-link"}
433
+ ::read-more{to="/docs/api/components/nuxt-link"}
434
434
  Learn more about `<NuxtLink>` usage.
435
435
  ::
436
436
 
@@ -461,27 +461,32 @@ function navigate () {
461
461
 
462
462
  ## Client-Only Pages
463
463
 
464
- You can define a page as [client only](/docs/4.x/directory-structure/app/components#client-components) by giving it a `.client.vue` suffix. None of the content of this page will be rendered on the server.
464
+ You can define a page as [client only](/docs/directory-structure/app/components#client-components) by giving it a `.client.vue` suffix. None of the content of this page will be rendered on the server.
465
465
 
466
466
  ## Server-Only Pages
467
467
 
468
- You can define a page as [server only](/docs/4.x/directory-structure/app/components#server-components) by giving it a `.server.vue` suffix. While you will be able to navigate to the page using client-side navigation, controlled by `vue-router`, it will be rendered with a server component automatically, meaning the code required to render the page will not be in your client-side bundle.
468
+ You can define a page as [server only](/docs/directory-structure/app/components#server-components) by giving it a `.server.vue` suffix. While you will be able to navigate to the page using client-side navigation, controlled by `vue-router`, it will be rendered with a server component automatically, meaning the code required to render the page will not be in your client-side bundle.
469
469
 
470
470
  ::warning
471
471
  Server-only pages must have a single root element. (HTML comments are considered elements as well.)
472
472
  ::
473
473
 
474
+ Navigating to a server-only page needs a request to render it, so when a `<NuxtLink>` to one is prefetched, Nuxt prefetches that response as well.
475
+
476
+ ::read-more{to="/docs/guide/concepts/server-components#the-client-navigation-round-trip"}
477
+ ::
478
+
474
479
  ## Custom Routing
475
480
 
476
481
  As your app gets bigger and more complex, your routing might require more flexibility. For this reason, Nuxt directly exposes the router, routes and router options for customization in different ways.
477
482
 
478
- :read-more{to="/docs/4.x/guide/recipes/custom-routing"}
483
+ :read-more{to="/docs/guide/recipes/custom-routing"}
479
484
 
480
485
  ## Multiple Pages Directories
481
486
 
482
487
  By default, all your pages should be in one `app/pages` directory at the root of your project.
483
488
 
484
- However, you can use [Nuxt Layers](/docs/4.x/getting-started/layers) to create groupings of your app's pages:
489
+ However, you can use [Nuxt Layers](/docs/getting-started/layers) to create groupings of your app's pages:
485
490
 
486
491
  ```bash [Directory Structure]
487
492
  -| some-app/
@@ -503,4 +508,4 @@ export default defineNuxtConfig({
503
508
  })
504
509
  ```
505
510
 
506
- :read-more{to="/docs/4.x/guide/going-further/layers"}
511
+ :read-more{to="/docs/guide/going-further/layers"}
@@ -30,7 +30,7 @@ Only files at the top level of the directory (or index files within any subdirec
30
30
 
31
31
  Only `foo.ts` and `bar/index.ts` would be registered.
32
32
 
33
- To add plugins in subdirectories, you can use the [`app/plugins`](/docs/4.x/api/nuxt-config#plugins-1) option in `nuxt.config.ts`:
33
+ To add plugins in subdirectories, you can use the [`app/plugins`](/docs/api/nuxt-config#plugins-1) option in `nuxt.config.ts`:
34
34
 
35
35
  ```ts twoslash [nuxt.config.ts]
36
36
  export default defineNuxtConfig({
@@ -43,7 +43,7 @@ export default defineNuxtConfig({
43
43
 
44
44
  ## Creating Plugins
45
45
 
46
- The only argument passed to a plugin is [`nuxtApp`](/docs/4.x/api/composables/use-nuxt-app).
46
+ The only argument passed to a plugin is [`nuxtApp`](/docs/api/composables/use-nuxt-app).
47
47
 
48
48
  ```ts twoslash [plugins/hello.ts]
49
49
  export default defineNuxtPlugin((nuxtApp) => {
@@ -134,7 +134,7 @@ export default defineNuxtPlugin({
134
134
 
135
135
  ## Using Composables
136
136
 
137
- You can use [composables](/docs/4.x/directory-structure/app/composables) as well as [utils](/docs/4.x/directory-structure/app/utils) within Nuxt plugins:
137
+ You can use [composables](/docs/directory-structure/app/composables) as well as [utils](/docs/directory-structure/app/utils) within Nuxt plugins:
138
138
 
139
139
  ```ts [app/plugins/hello.ts]
140
140
  export default defineNuxtPlugin((nuxtApp) => {
@@ -153,12 +153,12 @@ Plugins are called in order sequentially and before everything else. You might u
153
153
  ::important
154
154
  **If a composable depends on the Vue.js lifecycle, it won't work.** :br
155
155
 
156
- Normally, Vue.js composables are bound to the current component instance while plugins are only bound to [`nuxtApp`](/docs/4.x/api/composables/use-nuxt-app) instance.
156
+ Normally, Vue.js composables are bound to the current component instance while plugins are only bound to [`nuxtApp`](/docs/api/composables/use-nuxt-app) instance.
157
157
  ::
158
158
 
159
159
  ## Providing Helpers
160
160
 
161
- If you would like to provide a helper on the [`NuxtApp`](/docs/4.x/api/composables/use-nuxt-app) instance, return it from the plugin under a `provide` key.
161
+ If you would like to provide a helper on the [`NuxtApp`](/docs/api/composables/use-nuxt-app) instance, return it from the plugin under a `provide` key.
162
162
 
163
163
  ::code-group
164
164
  ```ts twoslash [plugins/hello.ts]
@@ -200,7 +200,7 @@ const { $hello } = useNuxtApp()
200
200
  ```
201
201
 
202
202
  ::important
203
- Note that we highly recommend using [`composables`](/docs/4.x/directory-structure/app/composables) instead of providing helpers to avoid polluting the global namespace and keep your main bundle entry small.
203
+ Note that we highly recommend using [`composables`](/docs/directory-structure/app/composables) instead of providing helpers to avoid polluting the global namespace and keep your main bundle entry small.
204
204
  ::
205
205
 
206
206
  ::warning
@@ -213,7 +213,7 @@ This is due to how Vue works with refs that aren't top-level to the template. Yo
213
213
  If you return your helpers from the plugin, they will be typed automatically; you'll find them typed for the return of `useNuxtApp()` and within your templates.
214
214
 
215
215
  ::note
216
- If you need to use a provided helper _within_ another plugin, you can call [`useNuxtApp()`](/docs/4.x/api/composables/use-nuxt-app) to get the typed version. But in general, this should be avoided unless you are certain of the plugins' order.
216
+ If you need to use a provided helper _within_ another plugin, you can call [`useNuxtApp()`](/docs/api/composables/use-nuxt-app) to get the typed version. But in general, this should be avoided unless you are certain of the plugins' order.
217
217
  ::
218
218
 
219
219
  For advanced use-cases, you can declare the type of injected properties like this: