@nuxt/docs-nightly 4.1.3-29313386.edc02e27 → 4.1.3-29316215.910d159d

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 (165) hide show
  1. package/1.getting-started/01.introduction.md +4 -4
  2. package/1.getting-started/02.installation.md +1 -1
  3. package/1.getting-started/03.configuration.md +25 -25
  4. package/1.getting-started/04.views.md +3 -3
  5. package/1.getting-started/05.assets.md +9 -3
  6. package/1.getting-started/06.styling.md +53 -43
  7. package/1.getting-started/07.routing.md +9 -9
  8. package/1.getting-started/08.seo-meta.md +50 -37
  9. package/1.getting-started/09.transitions.md +38 -33
  10. package/1.getting-started/10.data-fetching.md +61 -53
  11. package/1.getting-started/11.state-management.md +19 -12
  12. package/1.getting-started/12.error-handling.md +17 -15
  13. package/1.getting-started/13.server.md +8 -8
  14. package/1.getting-started/14.layers.md +19 -13
  15. package/1.getting-started/15.prerendering.md +28 -28
  16. package/1.getting-started/16.deployment.md +8 -8
  17. package/1.getting-started/17.testing.md +42 -42
  18. package/1.getting-started/18.upgrade.md +50 -68
  19. package/2.guide/0.index.md +5 -5
  20. package/2.guide/1.directory-structure/0.output.md +1 -1
  21. package/2.guide/1.directory-structure/1.app/1.assets.md +1 -1
  22. package/2.guide/1.directory-structure/1.app/1.components.md +40 -23
  23. package/2.guide/1.directory-structure/1.app/1.composables.md +9 -9
  24. package/2.guide/1.directory-structure/1.app/1.layouts.md +12 -8
  25. package/2.guide/1.directory-structure/1.app/1.middleware.md +23 -17
  26. package/2.guide/1.directory-structure/1.app/1.pages.md +25 -23
  27. package/2.guide/1.directory-structure/1.app/1.plugins.md +17 -17
  28. package/2.guide/1.directory-structure/1.app/1.utils.md +3 -3
  29. package/2.guide/1.directory-structure/1.app/3.app-config.md +7 -7
  30. package/2.guide/1.directory-structure/1.app/3.app.md +3 -3
  31. package/2.guide/1.directory-structure/1.app/3.error.md +4 -4
  32. package/2.guide/1.directory-structure/1.content.md +4 -1
  33. package/2.guide/1.directory-structure/1.modules.md +5 -5
  34. package/2.guide/1.directory-structure/1.public.md +1 -1
  35. package/2.guide/1.directory-structure/1.server.md +30 -30
  36. package/2.guide/1.directory-structure/1.shared.md +3 -3
  37. package/2.guide/1.directory-structure/2.env.md +3 -3
  38. package/2.guide/1.directory-structure/2.nuxtrc.md +1 -1
  39. package/2.guide/1.directory-structure/3.nuxt-config.md +1 -1
  40. package/2.guide/2.concepts/1.auto-imports.md +15 -15
  41. package/2.guide/2.concepts/10.nuxt-lifecycle.md +7 -7
  42. package/2.guide/2.concepts/2.vuejs-development.md +9 -9
  43. package/2.guide/2.concepts/3.rendering.md +17 -15
  44. package/2.guide/2.concepts/4.server-engine.md +1 -1
  45. package/2.guide/2.concepts/5.modules.md +3 -3
  46. package/2.guide/2.concepts/7.esm.md +16 -14
  47. package/2.guide/2.concepts/8.typescript.md +4 -4
  48. package/2.guide/3.going-further/1.events.md +3 -3
  49. package/2.guide/3.going-further/1.experimental-features.md +238 -77
  50. package/2.guide/3.going-further/1.features.md +44 -9
  51. package/2.guide/3.going-further/1.internals.md +15 -15
  52. package/2.guide/3.going-further/10.runtime-config.md +8 -8
  53. package/2.guide/3.going-further/11.nightly-release-channel.md +1 -1
  54. package/2.guide/3.going-further/2.hooks.md +11 -11
  55. package/2.guide/3.going-further/3.modules.md +83 -81
  56. package/2.guide/3.going-further/4.kit.md +5 -5
  57. package/2.guide/3.going-further/6.nuxt-app.md +4 -4
  58. package/2.guide/3.going-further/7.layers.md +51 -42
  59. package/2.guide/3.going-further/9.debugging.md +2 -2
  60. package/2.guide/4.recipes/1.custom-routing.md +19 -19
  61. package/2.guide/4.recipes/2.vite-plugin.md +3 -3
  62. package/2.guide/4.recipes/3.custom-usefetch.md +10 -10
  63. package/2.guide/4.recipes/4.sessions-and-authentication.md +34 -20
  64. package/2.guide/5.best-practices/performance.md +13 -13
  65. package/3.api/1.components/1.client-only.md +6 -3
  66. package/3.api/1.components/1.nuxt-client-fallback.md +10 -7
  67. package/3.api/1.components/11.teleports.md +5 -2
  68. package/3.api/1.components/12.nuxt-route-announcer.md +7 -7
  69. package/3.api/1.components/13.nuxt-time.md +44 -17
  70. package/3.api/1.components/2.nuxt-page.md +4 -4
  71. package/3.api/1.components/3.nuxt-layout.md +13 -8
  72. package/3.api/1.components/4.nuxt-link.md +40 -20
  73. package/3.api/1.components/5.nuxt-loading-indicator.md +1 -1
  74. package/3.api/1.components/6.nuxt-error-boundary.md +12 -10
  75. package/3.api/2.composables/on-prehydrate.md +2 -2
  76. package/3.api/2.composables/use-app-config.md +1 -1
  77. package/3.api/2.composables/use-async-data.md +14 -14
  78. package/3.api/2.composables/use-cookie.md +27 -19
  79. package/3.api/2.composables/use-error.md +2 -2
  80. package/3.api/2.composables/use-fetch.md +17 -17
  81. package/3.api/2.composables/use-head-safe.md +5 -5
  82. package/3.api/2.composables/use-head.md +3 -3
  83. package/3.api/2.composables/use-hydration.md +5 -5
  84. package/3.api/2.composables/use-lazy-async-data.md +2 -2
  85. package/3.api/2.composables/use-lazy-fetch.md +2 -2
  86. package/3.api/2.composables/use-loading-indicator.md +10 -10
  87. package/3.api/2.composables/use-nuxt-app.md +10 -10
  88. package/3.api/2.composables/use-nuxt-data.md +7 -7
  89. package/3.api/2.composables/use-preview-mode.md +12 -15
  90. package/3.api/2.composables/use-request-fetch.md +1 -1
  91. package/3.api/2.composables/use-request-headers.md +3 -3
  92. package/3.api/2.composables/use-response-header.md +7 -8
  93. package/3.api/2.composables/use-route-announcer.md +3 -3
  94. package/3.api/2.composables/use-router.md +6 -4
  95. package/3.api/2.composables/use-runtime-config.md +11 -11
  96. package/3.api/2.composables/use-runtime-hook.md +1 -1
  97. package/3.api/2.composables/use-seo-meta.md +3 -3
  98. package/3.api/2.composables/use-server-seo-meta.md +3 -3
  99. package/3.api/2.composables/use-state.md +4 -4
  100. package/3.api/3.utils/$fetch.md +6 -4
  101. package/3.api/3.utils/abort-navigation.md +2 -2
  102. package/3.api/3.utils/add-route-middleware.md +3 -3
  103. package/3.api/3.utils/call-once.md +5 -5
  104. package/3.api/3.utils/clear-error.md +2 -2
  105. package/3.api/3.utils/clear-nuxt-data.md +2 -2
  106. package/3.api/3.utils/clear-nuxt-state.md +2 -2
  107. package/3.api/3.utils/create-error.md +2 -2
  108. package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
  109. package/3.api/3.utils/define-nuxt-component.md +5 -5
  110. package/3.api/3.utils/define-nuxt-plugin.md +12 -12
  111. package/3.api/3.utils/define-nuxt-route-middleware.md +2 -2
  112. package/3.api/3.utils/define-page-meta.md +16 -16
  113. package/3.api/3.utils/define-route-rules.md +5 -5
  114. package/3.api/3.utils/navigate-to.md +10 -10
  115. package/3.api/3.utils/preload-components.md +1 -1
  116. package/3.api/3.utils/preload-route-components.md +2 -2
  117. package/3.api/3.utils/prerender-routes.md +2 -2
  118. package/3.api/3.utils/refresh-cookie.md +4 -4
  119. package/3.api/3.utils/refresh-nuxt-data.md +10 -5
  120. package/3.api/3.utils/reload-nuxt-app.md +3 -3
  121. package/3.api/3.utils/set-response-status.md +2 -2
  122. package/3.api/3.utils/show-error.md +3 -3
  123. package/3.api/3.utils/update-app-config.md +3 -2
  124. package/3.api/4.commands/generate.md +1 -1
  125. package/3.api/4.commands/prepare.md +4 -0
  126. package/3.api/4.commands/typecheck.md +1 -1
  127. package/3.api/5.kit/1.modules.md +36 -36
  128. package/3.api/5.kit/10.templates.md +8 -6
  129. package/3.api/5.kit/11.nitro.md +62 -62
  130. package/3.api/5.kit/12.resolving.md +2 -2
  131. package/3.api/5.kit/14.builder.md +1 -0
  132. package/3.api/5.kit/15.examples.md +2 -2
  133. package/3.api/5.kit/16.layers.md +26 -26
  134. package/3.api/5.kit/3.compatibility.md +12 -12
  135. package/3.api/5.kit/4.autoimports.md +12 -12
  136. package/3.api/5.kit/5.components.md +5 -5
  137. package/3.api/5.kit/6.context.md +3 -3
  138. package/3.api/5.kit/7.pages.md +4 -4
  139. package/3.api/5.kit/8.layout.md +1 -1
  140. package/3.api/5.kit/9.plugins.md +5 -4
  141. package/3.api/6.advanced/1.hooks.md +1 -1
  142. package/3.api/6.advanced/2.import-meta.md +3 -3
  143. package/3.api/6.nuxt-config.md +299 -864
  144. package/3.api/index.md +7 -7
  145. package/5.community/4.contribution.md +5 -5
  146. package/5.community/5.framework-contribution.md +1 -1
  147. package/6.bridge/1.overview.md +1 -1
  148. package/6.bridge/10.configuration.md +2 -1
  149. package/6.bridge/2.typescript.md +2 -2
  150. package/6.bridge/3.bridge-composition-api.md +4 -4
  151. package/6.bridge/4.plugins-and-middleware.md +5 -5
  152. package/6.bridge/5.nuxt3-compatible-api.md +12 -9
  153. package/6.bridge/6.meta.md +15 -14
  154. package/6.bridge/8.nitro.md +2 -2
  155. package/6.bridge/9.vite.md +3 -3
  156. package/7.migration/10.bundling.md +1 -1
  157. package/7.migration/11.server.md +3 -3
  158. package/7.migration/2.configuration.md +18 -16
  159. package/7.migration/20.module-authors.md +1 -1
  160. package/7.migration/4.meta.md +18 -15
  161. package/7.migration/5.plugins-and-middleware.md +8 -8
  162. package/7.migration/6.pages-and-layouts.md +20 -16
  163. package/7.migration/7.component-options.md +7 -7
  164. package/7.migration/8.runtime-config.md +4 -4
  165. package/package.json +1 -1
package/3.api/index.md CHANGED
@@ -7,25 +7,25 @@ surround: false
7
7
  ---
8
8
 
9
9
  ::card-group
10
- ::card{icon="i-lucide-box" title="Components" to="/docs/api/components/client-only"}
10
+ ::card{icon="i-lucide-box" title="Components" to="/docs/4.x/api/components/client-only"}
11
11
  Explore Nuxt built-in components for pages, layouts, head, and more.
12
12
  ::
13
- ::card{icon="i-lucide-arrow-left-right" title="Composables" to="/docs/api/composables/use-app-config"}
13
+ ::card{icon="i-lucide-arrow-left-right" title="Composables" to="/docs/4.x/api/composables/use-app-config"}
14
14
  Discover Nuxt composable functions for data-fetching, head management and more.
15
15
  ::
16
- ::card{icon="i-lucide-square-function" title="Utils" to="/docs/api/utils/dollarfetch"}
16
+ ::card{icon="i-lucide-square-function" title="Utils" to="/docs/4.x/api/utils/dollarfetch"}
17
17
  Learn about Nuxt utility functions for navigation, error handling and more.
18
18
  ::
19
- ::card{icon="i-lucide-square-terminal" title="Commands" to="/docs/api/commands/add"}
19
+ ::card{icon="i-lucide-square-terminal" title="Commands" to="/docs/4.x/api/commands/add"}
20
20
  List of Nuxt CLI commands to init, analyze, build, and preview your application.
21
21
  ::
22
- ::card{icon="i-lucide-package" title="Nuxt Kit" to="/docs/api/kit/modules"}
22
+ ::card{icon="i-lucide-package" title="Nuxt Kit" to="/docs/4.x/api/kit/modules"}
23
23
  Understand Nuxt Kit utilities to create modules and control Nuxt.
24
24
  ::
25
- ::card{icon="i-lucide-brain" title="Advanced" to="/docs/api/advanced/hooks"}
25
+ ::card{icon="i-lucide-brain" title="Advanced" to="/docs/4.x/api/advanced/hooks"}
26
26
  Go deep in Nuxt internals with Nuxt lifecycle hooks.
27
27
  ::
28
- ::card{icon="i-lucide-cog" title="Nuxt Configuration" to="/docs/api/nuxt-config"}
28
+ ::card{icon="i-lucide-cog" title="Nuxt Configuration" to="/docs/4.x/api/nuxt-config"}
29
29
  Explore all Nuxt configuration options to customize your application.
30
30
  ::
31
31
  ::
@@ -42,7 +42,7 @@ If you're working on a feature, then we ask that you **open a feature request is
42
42
 
43
43
  For typo fixes, it's recommended to batch multiple typo fixes into one pull request to maintain a cleaner commit history.
44
44
 
45
- For bigger changes to Nuxt itself, we recommend that you first [create a Nuxt module](/docs/community/contribution#create-a-module) and implement the feature there. This allows for quick proof-of-concept. You can then [create an RFC](/docs/community/contribution#make-an-rfc) in the form of a discussion. As users adopt it and you gather feedback, it can then be refined and either added to Nuxt core or continue as a standalone module.
45
+ For bigger changes to Nuxt itself, we recommend that you first [create a Nuxt module](/docs/4.x/community/contribution#create-a-module) and implement the feature there. This allows for quick proof-of-concept. You can then [create an RFC](/docs/4.x/community/contribution#make-an-rfc) in the form of a discussion. As users adopt it and you gather feedback, it can then be refined and either added to Nuxt core or continue as a standalone module.
46
46
 
47
47
  #### Commit Conventions
48
48
 
@@ -58,7 +58,7 @@ If you are working in a project with a monorepo, like `nuxt/nuxt`, ensure that y
58
58
 
59
59
  If you don't know how to send a pull request, we recommend reading [the guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
60
60
 
61
- When sending a pull request, make sure your PR's title also follows the [Commit Convention](/docs/community/contribution#commit-conventions).
61
+ When sending a pull request, make sure your PR's title also follows the [Commit Convention](/docs/4.x/community/contribution#commit-conventions).
62
62
 
63
63
  If your PR fixes or resolves existing issues, please make sure you mention them in the PR description.
64
64
 
@@ -106,7 +106,7 @@ If you need help while building it, feel free to [check in with us](/docs/4.x/co
106
106
 
107
107
  ### Make an RFC
108
108
 
109
- We highly recommend [creating a module](/docs/community/contribution#create-a-module) first to test out big new features and gain community adoption.
109
+ We highly recommend [creating a module](/docs/4.x/community/contribution#create-a-module) first to test out big new features and gain community adoption.
110
110
 
111
111
  If you have done this already, or it's not appropriate to create a new module, then please start by creating a new discussion. Make sure it explains your thinking as clearly as possible. Include code examples or function signatures for new APIs. Reference existing issues or pain points with examples.
112
112
 
@@ -172,7 +172,7 @@ We recommend using [VS Code](https://code.visualstudio.com) along with the [ESLi
172
172
 
173
173
  #### No Prettier
174
174
 
175
- Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run `yarn lint --fix`, `pnpm lint --fix`, or `bun run lint --fix` or referring the [ESLint section](/docs/community/contribution#use-eslint) for IDE Setup.
175
+ Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run `yarn lint --fix`, `pnpm lint --fix`, or `bun run lint --fix` or referring the [ESLint section](/docs/4.x/community/contribution#use-eslint) for IDE Setup.
176
176
 
177
177
  If you have Prettier installed in your editor, we recommend you disable it when working on the project to avoid conflict.
178
178
 
@@ -218,6 +218,6 @@ Here are some tips that may help improve your documentation:
218
218
  Nuxt will throw an error.
219
219
  ::
220
220
 
221
- ::read-more{to="/docs/community/framework-contribution#documentation-guide"}
221
+ ::read-more{to="/docs/4.x/community/framework-contribution#documentation-guide"}
222
222
  Learn how to contribute to the documentation.
223
223
  ::
@@ -42,7 +42,7 @@ To contribute to Nuxt, you need to set up a local environment.
42
42
  git checkout -b my-new-branch
43
43
  ```
44
44
 
45
- Then, test your changes against the [playground](/docs/community/framework-contribution#playground) and [test](/docs/community/framework-contribution#testing) your changes before submitting a pull request.
45
+ Then, test your changes against the [playground](/docs/4.x/community/framework-contribution#playground) and [test](/docs/4.x/community/framework-contribution#testing) your changes before submitting a pull request.
46
46
 
47
47
  ### Playground
48
48
 
@@ -86,7 +86,7 @@ You can use static `import`, dynamic `import()` and `export default` instead. Us
86
86
  import { defineNuxtConfig } from '@nuxt/bridge'
87
87
 
88
88
  export default defineNuxtConfig({
89
- bridge: false
89
+ bridge: false,
90
90
  })
91
91
  ```
92
92
 
@@ -11,6 +11,7 @@ You can check [bridge/src/module.ts](https://github.com/nuxt/bridge/blob/main/pa
11
11
 
12
12
  ```ts [nuxt.config.ts]
13
13
  import { defineNuxtConfig } from '@nuxt/bridge'
14
+
14
15
  export default defineNuxtConfig({
15
16
  bridge: {
16
17
 
@@ -63,7 +64,7 @@ export default defineNuxtConfig({
63
64
 
64
65
  vite: {
65
66
  // Config for Vite
66
- }
67
+ },
67
68
  })
68
69
  ```
69
70
 
@@ -16,8 +16,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
16
16
  export default defineNuxtConfig({
17
17
  bridge: {
18
18
  typescript: true,
19
- nitro: false // If migration to Nitro is complete, set to true
20
- }
19
+ nitro: false, // If migration to Nitro is complete, set to true
20
+ },
21
21
  })
22
22
  ```
23
23
 
@@ -47,8 +47,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
47
47
  export default defineNuxtConfig({
48
48
  bridge: {
49
49
  capi: true,
50
- nitro: false // If migration to Nitro is complete, set to true
51
- }
50
+ nitro: false, // If migration to Nitro is complete, set to true
51
+ },
52
52
  })
53
53
  ```
54
54
 
@@ -91,7 +91,7 @@ export default <Middleware> function (ctx) { }
91
91
 
92
92
  This was a type-helper stub function that is now removed.
93
93
 
94
- You may also keep using Nuxt 2-style plugins, by removing the function (as with [defineNuxtMiddleware](/docs/bridge/bridge-composition-api#definenuxtmiddleware)).
94
+ You may also keep using Nuxt 2-style plugins, by removing the function (as with [defineNuxtMiddleware](/docs/4.x/bridge/bridge-composition-api#definenuxtmiddleware)).
95
95
 
96
96
  Remove the `defineNuxtPlugin` wrapper:
97
97
 
@@ -113,7 +113,7 @@ export default <Plugin> function (ctx, inject) {}
113
113
  While this example is valid, Nuxt 3 introduces a new defineNuxtPlugin function that has a slightly different signature.
114
114
  ::
115
115
 
116
- :ReadMore{link="/docs/guide/directory-structure/app/plugins#creating-plugins"}
116
+ :ReadMore{link="/docs/4.x/guide/directory-structure/app/plugins#creating-plugins"}
117
117
 
118
118
  ### `useRouter` and `useRoute`
119
119
 
@@ -9,8 +9,8 @@ You can now migrate to the Nuxt 3 plugins API, which is slightly different in fo
9
9
 
10
10
  Plugins now take only one argument (`nuxtApp`). You can find out more in [the docs](/docs/4.x/guide/directory-structure/plugins).
11
11
 
12
- ```js [app/plugins/hello.ts]
13
- export default defineNuxtPlugin(nuxtApp => {
12
+ ```ts [app/plugins/hello.ts]
13
+ export default defineNuxtPlugin((nuxtApp) => {
14
14
  nuxtApp.provide('injected', () => 'my injected function')
15
15
  // now available on `nuxtApp.$injected`
16
16
  })
@@ -54,9 +54,9 @@ import { defineNuxtConfig } from '@nuxt/bridge'
54
54
  export default defineNuxtConfig({
55
55
  bridge: {
56
56
  macros: {
57
- pageMeta: true
58
- }
59
- }
57
+ pageMeta: true,
58
+ },
59
+ },
60
60
  })
61
61
  ```
62
62
 
@@ -73,8 +73,10 @@ You can access injected helpers using `useNuxtApp`.
73
73
 
74
74
  This helper function is not provided any more but you can replace it with the following code:
75
75
 
76
- ```js
77
- const wrapProperty = (property, makeComputed = true) => () => {
76
+ ```ts
77
+ import { computed, getCurrentInstance } from 'vue'
78
+
79
+ const wrapProperty = (property: string, makeComputed = true) => () => {
78
80
  const vm = getCurrentInstance().proxy
79
81
  return makeComputed ? computed(() => vm[property]) : vm[property]
80
82
  }
@@ -136,7 +138,7 @@ In order to interact with `vue-meta`, you may use `useNuxt2Meta`, which will wor
136
138
 
137
139
  You can also pass in computed values or refs, and the meta values will be updated reactively:
138
140
 
139
- ```ts
141
+ ```vue
140
142
  <script setup>
141
143
  const title = ref('my title')
142
144
  useNuxt2Meta({
@@ -165,10 +167,11 @@ You will also need to enable it explicitly in your `nuxt.config`:
165
167
 
166
168
  ```js
167
169
  import { defineNuxtConfig } from '@nuxt/bridge'
170
+
168
171
  export default defineNuxtConfig({
169
172
  bridge: {
170
- meta: true
171
- }
173
+ meta: true,
174
+ },
172
175
  })
173
176
  ```
174
177
 
@@ -182,7 +185,7 @@ Nuxt exposes every auto-import with the `#imports` alias that can be used to mak
182
185
 
183
186
  ```vue
184
187
  <script setup lang="ts">
185
- import { ref, computed } from '#imports'
188
+ import { computed, ref } from '#imports'
186
189
 
187
190
  const count = ref(1)
188
191
  const double = computed(() => count.value * 2)
@@ -196,9 +199,9 @@ If you want to disable auto-importing composables and utilities, you can set `im
196
199
  ```ts [nuxt.config.ts]
197
200
  export default defineNuxtConfig({
198
201
  imports: {
199
- autoImport: false
200
- }
202
+ autoImport: false,
203
+ },
201
204
  })
202
205
  ```
203
206
 
204
- This will disable auto-imports completely but it's still possible to use [explicit imports](/docs/bridge/nuxt3-compatible-api#explicit-imports) from `#imports`.
207
+ This will disable auto-imports completely but it's still possible to use [explicit imports](/docs/4.x/bridge/nuxt3-compatible-api#explicit-imports) from `#imports`.
@@ -13,11 +13,12 @@ If you need to use the Options API, there is a `head()` method you can use when
13
13
 
14
14
  ```js
15
15
  import { defineNuxtConfig } from '@nuxt/bridge'
16
+
16
17
  export default defineNuxtConfig({
17
18
  bridge: {
18
19
  meta: true,
19
- nitro: false // If migration to Nitro is complete, set to true
20
- }
20
+ nitro: false, // If migration to Nitro is complete, set to true
21
+ },
21
22
  })
22
23
  ```
23
24
 
@@ -34,9 +35,9 @@ export default {
34
35
  meta: [
35
36
  { charset: 'utf-8' },
36
37
  { name: 'viewport', content: 'width=device-width, initial-scale=1' },
37
- { hid: 'description', name: 'description', content: 'Meta description' }
38
- ]
39
- }
38
+ { hid: 'description', name: 'description', content: 'Meta description' },
39
+ ],
40
+ },
40
41
  }
41
42
  ```
42
43
 
@@ -48,10 +49,10 @@ export default defineNuxtConfig({
48
49
  meta: [
49
50
  { charset: 'utf-8' },
50
51
  { name: 'viewport', content: 'width=device-width, initial-scale=1' },
51
- { name: 'description', content: 'Meta description' }
52
- ]
53
- }
54
- }
52
+ { name: 'description', content: 'Meta description' },
53
+ ],
54
+ },
55
+ },
55
56
  })
56
57
  ```
57
58
 
@@ -90,10 +91,10 @@ export default defineNuxtComponent({
90
91
  return {
91
92
  meta: [{
92
93
  name: 'description',
93
- content: 'This is my page description.'
94
- }]
94
+ content: 'This is my page description.',
95
+ }],
95
96
  }
96
- }
97
+ },
97
98
  })
98
99
  </script>
99
100
  ```
@@ -110,8 +111,8 @@ If you want to use a function (for full control), then this cannot be set in you
110
111
  <script setup lang="ts">
111
112
  useHead({
112
113
  titleTemplate: (titleChunk) => {
113
- return titleChunk ? `${titleChunk} - Site Title` : 'Site Title';
114
- }
114
+ return titleChunk ? `${titleChunk} - Site Title` : 'Site Title'
115
+ },
115
116
  })
116
117
  </script>
117
118
  ```
@@ -14,8 +14,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
14
14
 
15
15
  export default defineNuxtConfig({
16
16
  bridge: {
17
- nitro: true
18
- }
17
+ nitro: true,
18
+ },
19
19
  })
20
20
  ```
21
21
 
@@ -19,8 +19,8 @@ import { defineNuxtConfig } from '@nuxt/bridge'
19
19
  export default defineNuxtConfig({
20
20
  bridge: {
21
21
  vite: true,
22
- nitro: true
23
- }
22
+ nitro: true,
23
+ },
24
24
  })
25
25
  ```
26
26
 
@@ -32,6 +32,6 @@ import { defineNuxtConfig } from '@nuxt/bridge'
32
32
  export default defineNuxtConfig({
33
33
  vite: {
34
34
  // Config for Vite
35
- }
35
+ },
36
36
  })
37
37
  ```
@@ -16,7 +16,7 @@ If you need to configure any of Nuxt's build tools, you can do so in your `nuxt.
16
16
 
17
17
  In addition, Nuxt ships with TypeScript support.
18
18
 
19
- :read-more{to="/docs/guide/concepts/typescript"}
19
+ :read-more{to="/docs/4.x/guide/concepts/typescript"}
20
20
 
21
21
  ## Steps
22
22
 
@@ -5,7 +5,7 @@ description: 'Learn how to migrate from Nuxt 2 to Nuxt 3 server.'
5
5
 
6
6
  In a built Nuxt 3 application, there is no runtime Nuxt dependency. That means your site will be highly performant, and ultra-slim. But it also means you can no longer hook into runtime Nuxt server hooks.
7
7
 
8
- :read-more{to="/docs/guide/concepts/server-engine"}
8
+ :read-more{to="/docs/4.x/guide/concepts/server-engine"}
9
9
 
10
10
  ## Steps
11
11
 
@@ -13,5 +13,5 @@ In a built Nuxt 3 application, there is no runtime Nuxt dependency. That means y
13
13
  2. Any files in `~/server/api` and `~/server/middleware` will be automatically registered; you can remove them from your `serverMiddleware` array.
14
14
  3. Update any other items in your `serverMiddleware` array to point to files or npm packages directly, rather than using inline functions.
15
15
 
16
- :read-more{to="/docs/guide/directory-structure/server"}
17
- :read-more{to="/docs/guide/going-further/hooks#server-hooks-runtime"}
16
+ :read-more{to="/docs/4.x/guide/directory-structure/server"}
17
+ :read-more{to="/docs/4.x/guide/going-further/hooks#server-hooks-runtime"}
@@ -40,8 +40,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
40
40
  router: {
41
41
  extendRoutes (routes) {
42
42
  //
43
- }
44
- }
43
+ },
44
+ },
45
45
  }
46
46
  ```
47
47
 
@@ -50,8 +50,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
50
50
  hooks: {
51
51
  'pages:extend' (routes) {
52
52
  //
53
- }
54
- }
53
+ },
54
+ },
55
55
  })
56
56
  ```
57
57
 
@@ -64,8 +64,8 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
64
64
  ```ts [Nuxt 2]
65
65
  export default {
66
66
  router: {
67
- routeNameSplitter: '/'
68
- }
67
+ routeNameSplitter: '/',
68
+ },
69
69
  }
70
70
  ```
71
71
 
@@ -78,8 +78,10 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
78
78
  const routeNameSplitter = '/'
79
79
  const root = createResolver(import.meta.url).resolve('./pages')
80
80
 
81
- function updateName(routes) {
82
- if (!routes) return
81
+ function updateName (routes) {
82
+ if (!routes) {
83
+ return
84
+ }
83
85
 
84
86
  for (const route of routes) {
85
87
  const relativePath = route.file.substring(root.length + 1)
@@ -138,7 +140,7 @@ If you are a module author, you can check out [more information about module com
138
140
 
139
141
  The `static/` (for storing static assets) has been renamed to `public/`. You can either rename your `static` directory to `public`, or keep the name by setting `dir.public` in your `nuxt.config`.
140
142
 
141
- :read-more{to="/docs/guide/directory-structure/public"}
143
+ :read-more{to="/docs/4.x/guide/directory-structure/public"}
142
144
 
143
145
  ## TypeScript
144
146
 
@@ -200,10 +202,10 @@ yarn add pinia @pinia/nuxt
200
202
  Enable the module in your nuxt configuration:
201
203
 
202
204
  ```ts [nuxt.config.ts]
203
- import { defineNuxtConfig } from 'nuxt/config';
205
+ import { defineNuxtConfig } from 'nuxt/config'
204
206
 
205
207
  export default defineNuxtConfig({
206
- modules: ['@pinia/nuxt']
208
+ modules: ['@pinia/nuxt'],
207
209
  })
208
210
  ```
209
211
 
@@ -217,7 +219,7 @@ export const useMainStore = defineStore('main', {
217
219
  counter: 0,
218
220
  }),
219
221
  actions: {
220
- increment() {
222
+ increment () {
221
223
  // `this` is the store instance
222
224
  this.counter++
223
225
  },
@@ -233,8 +235,8 @@ import { useMainStore } from '~/store'
233
235
  export default defineNuxtPlugin(({ $pinia }) => {
234
236
  return {
235
237
  provide: {
236
- store: useMainStore($pinia)
237
- }
238
+ store: useMainStore($pinia),
239
+ },
238
240
  }
239
241
  })
240
242
  ```
@@ -246,8 +248,8 @@ Once it's done you will need to add the following plugin to your Nuxt app:
246
248
  ```ts [app/plugins/vuex.ts]
247
249
  import store from '~/store'
248
250
 
249
- export default defineNuxtPlugin(nuxtApp => {
250
- nuxtApp.vueApp.use(store);
251
+ export default defineNuxtPlugin((nuxtApp) => {
252
+ nuxtApp.vueApp.use(store)
251
253
  })
252
254
  ```
253
255
 
@@ -17,7 +17,7 @@ Explore Nuxt 3 compatible modules.
17
17
 
18
18
  Nuxt 3 plugins are **not** fully backward compatible with Nuxt 2.
19
19
 
20
- :read-more{to="/docs/guide/directory-structure/plugins"}
20
+ :read-more{to="/docs/4.x/guide/directory-structure/plugins"}
21
21
 
22
22
  ### Vue Compatibility
23
23
 
@@ -14,7 +14,7 @@ You can customize `title`, `titleTemplate`, `base`, `script`, `noscript`, `style
14
14
  Nuxt currently uses [`Unhead`](https://github.com/unjs/unhead) to manage your meta tags, but implementation details may change.
15
15
  ::
16
16
 
17
- :read-more{to="/docs/getting-started/seo-meta"}
17
+ :read-more{to="/docs/4.x/getting-started/seo-meta"}
18
18
 
19
19
  ## Migration
20
20
 
@@ -31,18 +31,18 @@ Nuxt currently uses [`Unhead`](https://github.com/unjs/unhead) to manage your me
31
31
  export default {
32
32
  data: () => ({
33
33
  title: 'My App',
34
- description: 'My App Description'
35
- })
34
+ description: 'My App Description',
35
+ }),
36
36
  head () {
37
37
  return {
38
38
  title: this.title,
39
39
  meta: [{
40
40
  hid: 'description',
41
41
  name: 'description',
42
- content: this.description
43
- }]
42
+ content: this.description,
43
+ }],
44
44
  }
45
- }
45
+ },
46
46
  }
47
47
  </script>
48
48
  ```
@@ -57,8 +57,8 @@ useHead({
57
57
  title,
58
58
  meta: [{
59
59
  name: 'description',
60
- content: description
61
- }]
60
+ content: description,
61
+ }],
62
62
  })
63
63
  </script>
64
64
  ```
@@ -80,10 +80,10 @@ export default {
80
80
  meta: [{
81
81
  hid: 'description',
82
82
  name: 'description',
83
- content: 'My App Description'
84
- }]
83
+ content: 'My App Description',
84
+ }],
85
85
  }
86
- }
86
+ },
87
87
  }
88
88
  </script>
89
89
  ```
@@ -93,7 +93,10 @@ export default {
93
93
  <div>
94
94
  <Head>
95
95
  <Title>My App</Title>
96
- <Meta name="description" content="My app description"/>
96
+ <Meta
97
+ name="description"
98
+ content="My app description"
99
+ />
97
100
  </Head>
98
101
  <!-- -->
99
102
  </div>
@@ -118,10 +121,10 @@ export default defineNuxtComponent({
118
121
  return {
119
122
  meta: [{
120
123
  name: 'description',
121
- content: 'This is my page description.'
122
- }]
124
+ content: 'This is my page description.',
125
+ }],
123
126
  }
124
- }
127
+ },
125
128
  })
126
129
  </script>
127
130
  ```
@@ -9,31 +9,31 @@ Plugins now have a different format, and take only one argument (`nuxtApp`).
9
9
 
10
10
  ::code-group
11
11
 
12
- ```js [Nuxt 2]
12
+ ```ts [Nuxt 2]
13
13
  export default (ctx, inject) => {
14
14
  inject('injected', () => 'my injected function')
15
- })
15
+ }
16
16
  ```
17
17
 
18
18
  ```ts [Nuxt 3]
19
- export default defineNuxtPlugin(nuxtApp => {
19
+ export default defineNuxtPlugin((nuxtApp) => {
20
20
  // now available on `nuxtApp.$injected`
21
21
  nuxtApp.provide('injected', () => 'my injected function')
22
22
 
23
23
  // You can alternatively use this format, which comes with automatic type support
24
24
  return {
25
25
  provide: {
26
- injected: () => 'my injected function'
27
- }
26
+ injected: () => 'my injected function',
27
+ },
28
28
  }
29
29
  })
30
30
  ```
31
31
 
32
32
  ::
33
33
 
34
- :read-more{to="/docs/guide/directory-structure/plugins"}
34
+ :read-more{to="/docs/4.x/guide/directory-structure/plugins"}
35
35
 
36
- ::read-more{to="/docs/api/composables/use-nuxt-app"}
36
+ ::read-more{to="/docs/4.x/api/composables/use-nuxt-app"}
37
37
  Read more about the format of `nuxtApp`.
38
38
  ::
39
39
 
@@ -72,7 +72,7 @@ Much like Nuxt 2, route middleware placed in your `~/middleware` folder is autom
72
72
 
73
73
  `navigateTo` is one of a number of route helper functions.
74
74
 
75
- :read-more{to="/docs/guide/directory-structure/app/middleware"}
75
+ :read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
76
76
 
77
77
  ### Migration
78
78