@nuxt/docs-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430576.f48ea4c8

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 (250) hide show
  1. package/1.getting-started/01.introduction.md +1 -1
  2. package/1.getting-started/02.installation.md +4 -6
  3. package/1.getting-started/03.configuration.md +27 -27
  4. package/1.getting-started/04.views.md +5 -5
  5. package/1.getting-started/05.assets.md +8 -8
  6. package/1.getting-started/06.styling.md +15 -15
  7. package/1.getting-started/07.routing.md +10 -6
  8. package/1.getting-started/08.seo-meta.md +3 -3
  9. package/1.getting-started/09.transitions.md +10 -10
  10. package/1.getting-started/10.data-fetching.md +16 -16
  11. package/1.getting-started/11.state-management.md +3 -3
  12. package/1.getting-started/12.error-handling.md +6 -6
  13. package/1.getting-started/13.server.md +6 -6
  14. package/1.getting-started/14.layers.md +32 -13
  15. package/1.getting-started/16.deployment.md +1 -1
  16. package/1.getting-started/17.testing.md +36 -5
  17. package/1.getting-started/18.upgrade.md +43 -35
  18. package/{2.guide/1.directory-structure → 2.directory-structure}/0.nuxt.md +1 -1
  19. package/{2.guide/1.directory-structure → 2.directory-structure}/0.output.md +1 -1
  20. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.assets.md +2 -2
  21. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.components.md +6 -6
  22. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.composables.md +2 -2
  23. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.layouts.md +3 -3
  24. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.middleware.md +5 -5
  25. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.pages.md +17 -17
  26. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.plugins.md +3 -7
  27. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/1.utils.md +3 -3
  28. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app.md +4 -4
  29. package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.error.md +1 -3
  30. package/{2.guide/1.directory-structure → 2.directory-structure}/1.content.md +2 -2
  31. package/{2.guide/1.directory-structure → 2.directory-structure}/1.modules.md +2 -2
  32. package/{2.guide/1.directory-structure → 2.directory-structure}/1.node_modules.md +2 -2
  33. package/{2.guide/1.directory-structure → 2.directory-structure}/1.public.md +1 -1
  34. package/{2.guide/1.directory-structure → 2.directory-structure}/1.server.md +7 -7
  35. package/{2.guide/1.directory-structure → 2.directory-structure}/1.shared.md +3 -3
  36. package/{2.guide/1.directory-structure → 2.directory-structure}/2.env.md +2 -2
  37. package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtignore.md +1 -1
  38. package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtrc.md +1 -1
  39. package/{2.guide/1.directory-structure → 2.directory-structure}/3.nuxt-config.md +1 -1
  40. package/{2.guide/1.directory-structure → 2.directory-structure}/3.package.md +1 -1
  41. package/2.directory-structure/3.tsconfig.md +69 -0
  42. package/2.directory-structure/index.md +61 -0
  43. package/{2.guide → 3.guide}/0.index.md +10 -7
  44. package/{2.guide/2.concepts/3.rendering.md → 3.guide/1.concepts/1.rendering.md} +4 -30
  45. package/{2.guide/2.concepts/2.vuejs-development.md → 3.guide/1.concepts/10.vuejs-development.md} +7 -6
  46. package/{2.guide/2.concepts/10.nuxt-lifecycle.md → 3.guide/1.concepts/2.nuxt-lifecycle.md} +32 -25
  47. package/{2.guide/2.concepts/1.auto-imports.md → 3.guide/1.concepts/3.auto-imports.md} +7 -7
  48. package/{2.guide/2.concepts → 3.guide/1.concepts}/4.server-engine.md +3 -3
  49. package/{2.guide/2.concepts → 3.guide/1.concepts}/5.modules.md +2 -2
  50. package/{2.guide/2.concepts → 3.guide/1.concepts}/7.esm.md +3 -2
  51. package/{2.guide/2.concepts → 3.guide/1.concepts}/8.typescript.md +15 -38
  52. package/{2.guide/2.concepts → 3.guide/1.concepts}/9.code-style.md +1 -1
  53. package/{2.guide/5.best-practices → 3.guide/2.best-practices}/hydration.md +1 -1
  54. package/{2.guide/5.best-practices → 3.guide/2.best-practices}/performance.md +2 -2
  55. package/3.guide/3.ai/.navigation.yml +3 -0
  56. package/3.guide/3.ai/1.mcp.md +255 -0
  57. package/3.guide/3.ai/2.llms-txt.md +65 -0
  58. package/3.guide/4.modules/.navigation.yml +3 -0
  59. package/3.guide/4.modules/1.getting-started.md +103 -0
  60. package/3.guide/4.modules/2.module-anatomy.md +138 -0
  61. package/3.guide/4.modules/3.recipes-basics.md +299 -0
  62. package/3.guide/4.modules/4.recipes-advanced.md +231 -0
  63. package/3.guide/4.modules/5.testing.md +76 -0
  64. package/3.guide/4.modules/6.best-practices.md +104 -0
  65. package/3.guide/4.modules/7.ecosystem.md +32 -0
  66. package/3.guide/4.modules/index.md +36 -0
  67. package/{2.guide/4.recipes → 3.guide/5.recipes}/1.custom-routing.md +5 -5
  68. package/{2.guide/4.recipes → 3.guide/5.recipes}/2.vite-plugin.md +1 -1
  69. package/{2.guide/4.recipes → 3.guide/5.recipes}/3.custom-usefetch.md +1 -1
  70. package/{2.guide/4.recipes → 3.guide/5.recipes}/4.sessions-and-authentication.md +1 -1
  71. package/{2.guide/3.going-further → 3.guide/6.going-further}/1.events.md +2 -3
  72. package/{2.guide/3.going-further → 3.guide/6.going-further}/1.experimental-features.md +10 -10
  73. package/{2.guide/3.going-further → 3.guide/6.going-further}/1.features.md +1 -1
  74. package/{2.guide/3.going-further → 3.guide/6.going-further}/1.internals.md +5 -4
  75. package/{2.guide/3.going-further → 3.guide/6.going-further}/10.runtime-config.md +2 -2
  76. package/{2.guide/3.going-further → 3.guide/6.going-further}/2.hooks.md +3 -3
  77. package/{2.guide/3.going-further → 3.guide/6.going-further}/4.kit.md +1 -1
  78. package/{2.guide/3.going-further → 3.guide/6.going-further}/6.nuxt-app.md +5 -5
  79. package/{2.guide/3.going-further → 3.guide/6.going-further}/7.layers.md +42 -25
  80. package/{2.guide/3.going-further → 3.guide/6.going-further}/9.debugging.md +1 -1
  81. package/{3.api → 4.api}/1.components/10.nuxt-picture.md +1 -1
  82. package/{3.api → 4.api}/1.components/11.teleports.md +1 -1
  83. package/{3.api → 4.api}/1.components/12.nuxt-route-announcer.md +1 -3
  84. package/{3.api → 4.api}/1.components/13.nuxt-time.md +0 -2
  85. package/{3.api → 4.api}/1.components/2.nuxt-page.md +3 -3
  86. package/{3.api → 4.api}/1.components/3.nuxt-layout.md +5 -5
  87. package/{3.api → 4.api}/1.components/4.nuxt-link.md +11 -11
  88. package/{3.api → 4.api}/1.components/5.nuxt-loading-indicator.md +1 -1
  89. package/{3.api → 4.api}/1.components/6.nuxt-error-boundary.md +1 -1
  90. package/{3.api → 4.api}/1.components/7.nuxt-welcome.md +2 -2
  91. package/{3.api → 4.api}/2.composables/use-app-config.md +1 -1
  92. package/{3.api → 4.api}/2.composables/use-async-data.md +76 -13
  93. package/4.api/2.composables/use-cookie.md +183 -0
  94. package/{3.api → 4.api}/2.composables/use-fetch.md +33 -33
  95. package/{3.api → 4.api}/2.composables/use-head-safe.md +37 -20
  96. package/4.api/2.composables/use-head.md +184 -0
  97. package/{3.api → 4.api}/2.composables/use-hydration.md +24 -18
  98. package/4.api/2.composables/use-lazy-async-data.md +96 -0
  99. package/4.api/2.composables/use-lazy-fetch.md +111 -0
  100. package/{3.api → 4.api}/2.composables/use-nuxt-app.md +7 -7
  101. package/{3.api → 4.api}/2.composables/use-nuxt-data.md +1 -1
  102. package/{3.api → 4.api}/2.composables/use-request-fetch.md +1 -1
  103. package/{3.api → 4.api}/2.composables/use-response-header.md +1 -1
  104. package/{3.api → 4.api}/2.composables/use-route-announcer.md +0 -2
  105. package/{3.api → 4.api}/2.composables/use-route.md +2 -2
  106. package/4.api/2.composables/use-router.md +94 -0
  107. package/{3.api → 4.api}/2.composables/use-runtime-config.md +1 -1
  108. package/{3.api → 4.api}/2.composables/use-runtime-hook.md +1 -1
  109. package/{3.api → 4.api}/2.composables/use-state.md +1 -1
  110. package/{3.api → 4.api}/3.utils/$fetch.md +1 -1
  111. package/{3.api → 4.api}/3.utils/abort-navigation.md +3 -3
  112. package/{3.api → 4.api}/3.utils/add-route-middleware.md +1 -1
  113. package/{3.api → 4.api}/3.utils/call-once.md +0 -2
  114. package/{3.api → 4.api}/3.utils/define-lazy-hydration-component.md +4 -4
  115. package/{3.api → 4.api}/3.utils/define-nuxt-component.md +1 -1
  116. package/4.api/3.utils/define-nuxt-plugin.md +102 -0
  117. package/{3.api → 4.api}/3.utils/define-nuxt-route-middleware.md +2 -2
  118. package/{3.api → 4.api}/3.utils/define-page-meta.md +14 -14
  119. package/{3.api → 4.api}/3.utils/navigate-to.md +15 -15
  120. package/{3.api → 4.api}/3.utils/on-before-route-leave.md +1 -1
  121. package/{3.api → 4.api}/3.utils/on-before-route-update.md +1 -1
  122. package/{3.api → 4.api}/3.utils/refresh-cookie.md +1 -3
  123. package/{3.api → 4.api}/3.utils/update-app-config.md +2 -2
  124. package/{3.api → 4.api}/4.commands/add.md +11 -11
  125. package/4.api/4.commands/analyze.md +42 -0
  126. package/4.api/4.commands/build-module.md +42 -0
  127. package/4.api/4.commands/build.md +47 -0
  128. package/{3.api → 4.api}/4.commands/cleanup.md +6 -6
  129. package/4.api/4.commands/dev.md +60 -0
  130. package/{3.api → 4.api}/4.commands/devtools.md +7 -7
  131. package/4.api/4.commands/generate.md +42 -0
  132. package/4.api/4.commands/info.md +33 -0
  133. package/4.api/4.commands/init.md +50 -0
  134. package/4.api/4.commands/module.md +84 -0
  135. package/4.api/4.commands/prepare.md +41 -0
  136. package/4.api/4.commands/preview.md +44 -0
  137. package/4.api/4.commands/test.md +40 -0
  138. package/4.api/4.commands/typecheck.md +44 -0
  139. package/4.api/4.commands/upgrade.md +37 -0
  140. package/{3.api → 4.api}/5.kit/1.modules.md +18 -18
  141. package/{3.api → 4.api}/5.kit/10.templates.md +23 -23
  142. package/{3.api → 4.api}/5.kit/11.nitro.md +35 -35
  143. package/{3.api → 4.api}/5.kit/14.builder.md +21 -21
  144. package/{3.api → 4.api}/5.kit/16.layers.md +12 -12
  145. package/{3.api → 4.api}/5.kit/2.programmatic.md +2 -2
  146. package/{3.api → 4.api}/5.kit/4.autoimports.md +18 -18
  147. package/4.api/5.kit/5.components.md +146 -0
  148. package/4.api/6.advanced/1.hooks.md +105 -0
  149. package/{3.api → 4.api}/6.nuxt-config.md +29 -28
  150. package/5.community/3.reporting-bugs.md +1 -1
  151. package/5.community/4.contribution.md +4 -4
  152. package/5.community/5.framework-contribution.md +8 -8
  153. package/5.community/6.roadmap.md +25 -25
  154. package/5.community/7.changelog.md +10 -0
  155. package/6.bridge/1.overview.md +1 -1
  156. package/6.bridge/2.typescript.md +1 -1
  157. package/6.bridge/3.bridge-composition-api.md +1 -1
  158. package/6.bridge/4.plugins-and-middleware.md +2 -2
  159. package/7.migration/11.server.md +1 -1
  160. package/7.migration/2.configuration.md +5 -5
  161. package/7.migration/20.module-authors.md +3 -3
  162. package/7.migration/3.auto-imports.md +1 -1
  163. package/7.migration/5.plugins-and-middleware.md +2 -2
  164. package/7.migration/6.pages-and-layouts.md +6 -6
  165. package/README.md +1 -1
  166. package/package.json +1 -1
  167. package/2.guide/1.directory-structure/3.tsconfig.md +0 -38
  168. package/2.guide/3.going-further/3.modules.md +0 -901
  169. package/3.api/2.composables/use-cookie.md +0 -183
  170. package/3.api/2.composables/use-head.md +0 -69
  171. package/3.api/2.composables/use-lazy-async-data.md +0 -47
  172. package/3.api/2.composables/use-lazy-fetch.md +0 -55
  173. package/3.api/2.composables/use-router.md +0 -94
  174. package/3.api/3.utils/define-nuxt-plugin.md +0 -102
  175. package/3.api/4.commands/analyze.md +0 -42
  176. package/3.api/4.commands/build-module.md +0 -42
  177. package/3.api/4.commands/build.md +0 -47
  178. package/3.api/4.commands/dev.md +0 -60
  179. package/3.api/4.commands/generate.md +0 -42
  180. package/3.api/4.commands/info.md +0 -33
  181. package/3.api/4.commands/init.md +0 -50
  182. package/3.api/4.commands/module.md +0 -84
  183. package/3.api/4.commands/prepare.md +0 -41
  184. package/3.api/4.commands/preview.md +0 -44
  185. package/3.api/4.commands/test.md +0 -40
  186. package/3.api/4.commands/typecheck.md +0 -44
  187. package/3.api/4.commands/upgrade.md +0 -37
  188. package/3.api/5.kit/5.components.md +0 -146
  189. package/3.api/6.advanced/1.hooks.md +0 -105
  190. /package/{2.guide/1.directory-structure → 2.directory-structure}/.navigation.yml +0 -0
  191. /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/.navigation.yml +0 -0
  192. /package/{2.guide/1.directory-structure → 2.directory-structure}/1.app/3.app-config.md +0 -0
  193. /package/{2.guide/1.directory-structure → 2.directory-structure}/2.gitignore.md +0 -0
  194. /package/{2.guide → 3.guide}/.navigation.yml +0 -0
  195. /package/{2.guide/2.concepts → 3.guide/1.concepts}/.navigation.yml +0 -0
  196. /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/.navigation.yml +0 -0
  197. /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/plugins.md +0 -0
  198. /package/{2.guide/4.recipes → 3.guide/5.recipes}/.navigation.yml +0 -0
  199. /package/{2.guide/3.going-further → 3.guide/6.going-further}/.navigation.yml +0 -0
  200. /package/{2.guide/3.going-further → 3.guide/6.going-further}/11.nightly-release-channel.md +0 -0
  201. /package/{2.guide/3.going-further → 3.guide/6.going-further}/index.md +0 -0
  202. /package/{3.api → 4.api}/.navigation.yml +0 -0
  203. /package/{3.api → 4.api}/1.components/.navigation.yml +0 -0
  204. /package/{3.api → 4.api}/1.components/1.client-only.md +0 -0
  205. /package/{3.api → 4.api}/1.components/1.dev-only.md +0 -0
  206. /package/{3.api → 4.api}/1.components/1.nuxt-client-fallback.md +0 -0
  207. /package/{3.api → 4.api}/1.components/8.nuxt-island.md +0 -0
  208. /package/{3.api → 4.api}/1.components/9.nuxt-img.md +0 -0
  209. /package/{3.api → 4.api}/2.composables/.navigation.yml +0 -0
  210. /package/{3.api → 4.api}/2.composables/on-prehydrate.md +0 -0
  211. /package/{3.api → 4.api}/2.composables/use-error.md +0 -0
  212. /package/{3.api → 4.api}/2.composables/use-loading-indicator.md +0 -0
  213. /package/{3.api → 4.api}/2.composables/use-preview-mode.md +0 -0
  214. /package/{3.api → 4.api}/2.composables/use-request-event.md +0 -0
  215. /package/{3.api → 4.api}/2.composables/use-request-header.md +0 -0
  216. /package/{3.api → 4.api}/2.composables/use-request-headers.md +0 -0
  217. /package/{3.api → 4.api}/2.composables/use-request-url.md +0 -0
  218. /package/{3.api → 4.api}/2.composables/use-seo-meta.md +0 -0
  219. /package/{3.api → 4.api}/2.composables/use-server-seo-meta.md +0 -0
  220. /package/{3.api → 4.api}/3.utils/.navigation.yml +0 -0
  221. /package/{3.api → 4.api}/3.utils/clear-error.md +0 -0
  222. /package/{3.api → 4.api}/3.utils/clear-nuxt-data.md +0 -0
  223. /package/{3.api → 4.api}/3.utils/clear-nuxt-state.md +0 -0
  224. /package/{3.api → 4.api}/3.utils/create-error.md +0 -0
  225. /package/{3.api → 4.api}/3.utils/define-route-rules.md +0 -0
  226. /package/{3.api → 4.api}/3.utils/on-nuxt-ready.md +0 -0
  227. /package/{3.api → 4.api}/3.utils/prefetch-components.md +0 -0
  228. /package/{3.api → 4.api}/3.utils/preload-components.md +0 -0
  229. /package/{3.api → 4.api}/3.utils/preload-route-components.md +0 -0
  230. /package/{3.api → 4.api}/3.utils/prerender-routes.md +0 -0
  231. /package/{3.api → 4.api}/3.utils/refresh-nuxt-data.md +0 -0
  232. /package/{3.api → 4.api}/3.utils/reload-nuxt-app.md +0 -0
  233. /package/{3.api → 4.api}/3.utils/set-page-layout.md +0 -0
  234. /package/{3.api → 4.api}/3.utils/set-response-status.md +0 -0
  235. /package/{3.api → 4.api}/3.utils/show-error.md +0 -0
  236. /package/{3.api → 4.api}/4.commands/.navigation.yml +0 -0
  237. /package/{3.api → 4.api}/5.kit/.navigation.yml +0 -0
  238. /package/{3.api → 4.api}/5.kit/10.runtime-config.md +0 -0
  239. /package/{3.api → 4.api}/5.kit/12.resolving.md +0 -0
  240. /package/{3.api → 4.api}/5.kit/13.logging.md +0 -0
  241. /package/{3.api → 4.api}/5.kit/15.examples.md +0 -0
  242. /package/{3.api → 4.api}/5.kit/3.compatibility.md +0 -0
  243. /package/{3.api → 4.api}/5.kit/6.context.md +0 -0
  244. /package/{3.api → 4.api}/5.kit/7.pages.md +0 -0
  245. /package/{3.api → 4.api}/5.kit/8.layout.md +0 -0
  246. /package/{3.api → 4.api}/5.kit/9.head.md +0 -0
  247. /package/{3.api → 4.api}/5.kit/9.plugins.md +0 -0
  248. /package/{3.api → 4.api}/6.advanced/.navigation.yml +0 -0
  249. /package/{3.api → 4.api}/6.advanced/2.import-meta.md +0 -0
  250. /package/{3.api → 4.api}/index.md +0 -0
@@ -19,7 +19,7 @@ If you want to play around with Nuxt in your browser, you can [try it out in one
19
19
 
20
20
  Nuxt uses conventions and an opinionated directory structure to automate repetitive tasks and allow developers to focus on pushing features. The configuration file can still customize and override its default behaviors.
21
21
 
22
- - **File-based routing:** define routes based on the structure of your [`app/pages/` directory](/docs/4.x/guide/directory-structure/app/pages). This can make it easier to organize your application and avoid the need for manual route configuration.
22
+ - **File-based routing:** define routes based on the structure of your [`app/pages/` directory](/docs/4.x/directory-structure/app/pages). This can make it easier to organize your application and avoid the need for manual route configuration.
23
23
  - **Code splitting:** Nuxt automatically splits your code into smaller chunks, which can help reduce the initial load time of your application.
24
24
  - **Server-side rendering out of the box:** Nuxt comes with built-in SSR capabilities, so you don't have to set up a separate server yourself.
25
25
  - **Auto-imports:** write Vue composables and components in their respective directories and use them without having to import them with the benefits of tree-shaking and optimized JS bundles.
@@ -17,9 +17,7 @@ Or follow the steps below to set up a new Nuxt project on your computer.
17
17
 
18
18
  ## New Project
19
19
 
20
- <!-- TODO: need to fix upstream in nuxt/nuxt.com -->
21
- <!-- markdownlint-disable-next-line MD001 -->
22
- #### Prerequisites
20
+ ### Prerequisites
23
21
 
24
22
  - **Node.js** - [`20.x`](https://nodejs.org/en) or newer (but we recommend the [active LTS release](https://github.com/nodejs/release#release-schedule))
25
23
  - **Text editor** - There is no IDE requirement, but we recommend [Visual Studio Code](https://code.visualstudio.com/) with the [official Vue extension](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (previously known as Volar) or [WebStorm](https://www.jetbrains.com/webstorm/), which, along with [other JetBrains IDEs](https://www.jetbrains.com/ides/), offers great Nuxt support right out-of-the-box.
@@ -30,12 +28,12 @@ Or follow the steps below to set up a new Nuxt project on your computer.
30
28
  :summary[Additional notes for an optimal setup:]
31
29
  - **Node.js**: Make sure to use an even numbered version (20, 22, etc.)
32
30
  - **Nuxtr**: Install the community-developed [Nuxtr extension](https://marketplace.visualstudio.com/items?itemName=Nuxtr.nuxtr-vscode)
33
- - **WSL**: If you are using Windows and experience slow HMR, you may want to try using [WSL (Windows Subsystem for Linux)](https://docs.microsoft.com/en-us/windows/wsl/install) which may solve some performance issues.
34
- - **Windows slow DNS resolution** - instead of using `localhost:3000` for local dev server on Windows, use `127.0.0.1` for much faster loading experience on browsers.
31
+ - **WSL**: If you are using Windows and experience slow HMR, you may want to try using [WSL (Windows Subsystem for Linux)](https://learn.microsoft.com/en-us/windows/wsl/install) which may solve some performance issues.
32
+ - **Windows slow DNS resolution**: Instead of using `localhost:3000` for local dev server on Windows, use `127.0.0.1` for much faster loading experience on browsers.
35
33
  ::
36
34
  ::
37
35
 
38
- Open a terminal (if you're using [Visual Studio Code](https://code.visualstudio.com), you can open an [integrated terminal](https://code.visualstudio.com/docs/editor/integrated-terminal)) and use the following command to create a new starter project:
36
+ Open a terminal (if you're using [Visual Studio Code](https://code.visualstudio.com), you can open an [integrated terminal](https://code.visualstudio.com/docs/terminal/basics)) and use the following command to create a new starter project:
39
37
 
40
38
  ::code-group{sync="pm"}
41
39
 
@@ -4,11 +4,11 @@ description: Nuxt is configured with sensible defaults to make you productive.
4
4
  navigation.icon: i-lucide-cog
5
5
  ---
6
6
 
7
- By default, Nuxt is configured to cover most use cases. The [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file can override or extend this default configuration.
7
+ By default, Nuxt is configured to cover most use cases. The [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) file can override or extend this default configuration.
8
8
 
9
9
  ## Nuxt Configuration
10
10
 
11
- The [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file is located at the root of a Nuxt project and can override or extend the application's behavior.
11
+ The [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) file is located at the root of a Nuxt project and can override or extend the application's behavior.
12
12
 
13
13
  A minimal configuration file exports the `defineNuxtConfig` function containing an object with your configuration. The `defineNuxtConfig` helper is globally available without import.
14
14
 
@@ -124,7 +124,7 @@ const appConfig = useAppConfig()
124
124
  </script>
125
125
  ```
126
126
 
127
- :read-more{to="/docs/4.x/guide/directory-structure/app-config"}
127
+ :read-more{to="/docs/4.x/directory-structure/app/app-config"}
128
128
 
129
129
  ## `runtimeConfig` vs. `app.config`
130
130
 
@@ -133,37 +133,37 @@ As stated above, `runtimeConfig` and `app.config` are both used to expose variab
133
133
  - `runtimeConfig`: Private or public tokens that need to be specified after build using environment variables.
134
134
  - `app.config`: Public tokens that are determined at build time, website configuration such as theme variant, title and any project config that are not sensitive.
135
135
 
136
- Feature | `runtimeConfig` | `app.config`
137
- -------------------------------|------------------|-------------------
138
- Client Side | Hydrated | Bundled
139
- Environment Variables | ✅ Yes | ❌ No
140
- Reactive | ✅ Yes | ✅ Yes
141
- Types support | ✅ Partial | ✅ Yes
142
- Configuration per Request | ❌ No | ✅ Yes
143
- Hot Module Replacement | ❌ No | ✅ Yes
144
- Non primitive JS types | ❌ No | ✅ Yes
136
+ | Feature | `runtimeConfig` | `app.config` |
137
+ |---------------------------|-----------------|--------------|
138
+ | Client Side | Hydrated | Bundled |
139
+ | Environment Variables | ✅ Yes | ❌ No |
140
+ | Reactive | ✅ Yes | ✅ Yes |
141
+ | Types support | ✅ Partial | ✅ Yes |
142
+ | Configuration per Request | ❌ No | ✅ Yes |
143
+ | Hot Module Replacement | ❌ No | ✅ Yes |
144
+ | Non primitive JS types | ❌ No | ✅ Yes |
145
145
 
146
146
  ## External Configuration Files
147
147
 
148
- Nuxt uses [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file as the single source of truth for configurations and skips reading external configuration files. During the course of building your project, you may have a need to configure those. The following table highlights common configurations and, where applicable, how they can be configured with Nuxt.
148
+ Nuxt uses [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) file as the single source of truth for configurations and skips reading external configuration files. During the course of building your project, you may have a need to configure those. The following table highlights common configurations and, where applicable, how they can be configured with Nuxt.
149
149
 
150
- Name | Config File | How To Configure
151
- ---------------------------------------------|---------------------------|-------------------------
152
- [Nitro](https://nitro.build) | ~~`nitro.config.ts`~~ | Use [`nitro`](/docs/4.x/api/nuxt-config#nitro) key in `nuxt.config`
153
- [PostCSS](https://postcss.org) | ~~`postcss.config.js`~~ | Use [`postcss`](/docs/4.x/api/nuxt-config#postcss) key in `nuxt.config`
154
- [Vite](https://vite.dev) | ~~`vite.config.ts`~~ | Use [`vite`](/docs/4.x/api/nuxt-config#vite) key in `nuxt.config`
155
- [webpack](https://webpack.js.org) | ~~`webpack.config.ts`~~ | Use [`webpack`](/docs/4.x/api/nuxt-config#webpack-1) key in `nuxt.config`
150
+ | Name | Config File | How To Configure |
151
+ |-----------------------------------|-------------------------|---------------------------------------------------------------------------|
152
+ | [Nitro](https://nitro.build) | ~~`nitro.config.ts`~~ | Use [`nitro`](/docs/4.x/api/nuxt-config#nitro) key in `nuxt.config` |
153
+ | [PostCSS](https://postcss.org) | ~~`postcss.config.js`~~ | Use [`postcss`](/docs/4.x/api/nuxt-config#postcss) key in `nuxt.config` |
154
+ | [Vite](https://vite.dev) | ~~`vite.config.ts`~~ | Use [`vite`](/docs/4.x/api/nuxt-config#vite) key in `nuxt.config` |
155
+ | [webpack](https://webpack.js.org) | ~~`webpack.config.ts`~~ | Use [`webpack`](/docs/4.x/api/nuxt-config#webpack-1) key in `nuxt.config` |
156
156
 
157
157
  Here is a list of other common config files:
158
158
 
159
- Name | Config File | How To Configure
160
- ---------------------------------------------|-------------------------|--------------------------
161
- [TypeScript](https://www.typescriptlang.org) | `tsconfig.json` | [More Info](/docs/4.x/guide/directory-structure/tsconfig)
162
- [ESLint](https://eslint.org) | `eslint.config.js` | [More Info](https://eslint.org/docs/latest/use/configure/configuration-files)
163
- [Prettier](https://prettier.io) | `prettier.config.js` | [More Info](https://prettier.io/docs/en/configuration.html)
164
- [Stylelint](https://stylelint.io) | `stylelint.config.js` | [More Info](https://stylelint.io/user-guide/configure)
165
- [TailwindCSS](https://tailwindcss.com) | `tailwind.config.js` | [More Info](https://tailwindcss.nuxtjs.org/tailwindcss/configuration)
166
- [Vitest](https://vitest.dev) | `vitest.config.ts` | [More Info](https://vitest.dev/config/)
159
+ | Name | Config File | How To Configure |
160
+ |----------------------------------------------|-----------------------|-------------------------------------------------------------------------------|
161
+ | [TypeScript](https://www.typescriptlang.org) | `tsconfig.json` | [More Info](/docs/4.x/directory-structure/tsconfig) |
162
+ | [ESLint](https://eslint.org) | `eslint.config.js` | [More Info](https://eslint.org/docs/latest/use/configure/configuration-files) |
163
+ | [Prettier](https://prettier.io) | `prettier.config.js` | [More Info](https://prettier.io/docs/configuration.html) |
164
+ | [Stylelint](https://stylelint.io) | `stylelint.config.js` | [More Info](https://stylelint.io/user-guide/configure/) |
165
+ | [TailwindCSS](https://tailwindcss.com) | `tailwind.config.js` | [More Info](https://tailwindcss.nuxtjs.org/tailwindcss/configuration/) |
166
+ | [Vitest](https://vitest.dev) | `vitest.config.ts` | [More Info](https://vitest.dev/config/) |
167
167
 
168
168
  ## Vue Configuration
169
169
 
@@ -26,7 +26,7 @@ If you are familiar with Vue, you might wonder where `main.js` is (the file that
26
26
 
27
27
  ![Components are reusable pieces of UI](/assets/docs/getting-started/views/components.svg)
28
28
 
29
- Most components are reusable pieces of the user interface, like buttons and menus. In Nuxt, you can create these components in the [`app/components/`](/docs/4.x/guide/directory-structure/app/components) directory, and they will be automatically available across your application without having to explicitly import them.
29
+ Most components are reusable pieces of the user interface, like buttons and menus. In Nuxt, you can create these components in the [`app/components/`](/docs/4.x/directory-structure/app/components) directory, and they will be automatically available across your application without having to explicitly import them.
30
30
 
31
31
  ::code-group
32
32
 
@@ -55,9 +55,9 @@ Most components are reusable pieces of the user interface, like buttons and menu
55
55
 
56
56
  ![Pages are views tied to a specific route](/assets/docs/getting-started/views/pages.svg)
57
57
 
58
- Pages represent views for each specific route pattern. Every file in the [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory represents a different route displaying its content.
58
+ Pages represent views for each specific route pattern. Every file in the [`app/pages/`](/docs/4.x/directory-structure/app/pages) directory represents a different route displaying its content.
59
59
 
60
- To use pages, create an `app/pages/index.vue` file and add `<NuxtPage />` component to the [`app/app.vue`](/docs/4.x/guide/directory-structure/app) (or remove `app/app.vue` for default entry). You can now create more pages and their corresponding routes by adding new files in the [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory.
60
+ To use pages, create an `app/pages/index.vue` file and add `<NuxtPage />` component to the [`app/app.vue`](/docs/4.x/directory-structure/app/app) (or remove `app/app.vue` for default entry). You can now create more pages and their corresponding routes by adding new files in the [`app/pages/`](/docs/4.x/directory-structure/app/pages) directory.
61
61
 
62
62
  ::code-group
63
63
 
@@ -91,7 +91,7 @@ To use pages, create an `app/pages/index.vue` file and add `<NuxtPage />` compon
91
91
  Layouts are wrappers around pages that contain a common User Interface for several pages, such as header and footer displays. Layouts are Vue files using `<slot />` components to display the **page** content. The `app/layouts/default.vue` file will be used by default. Custom layouts can be set as part of your page metadata.
92
92
 
93
93
  ::note
94
- If you only have a single layout in your application, we recommend using [`app/app.vue`](/docs/4.x/guide/directory-structure/app) with [`<NuxtPage />`](/docs/4.x/api/components/nuxt-page) instead.
94
+ If you only have a single layout in your application, we recommend using [`app/app.vue`](/docs/4.x/directory-structure/app/app) with [`<NuxtPage />`](/docs/4.x/api/components/nuxt-page) instead.
95
95
  ::
96
96
 
97
97
  ::code-group
@@ -137,7 +137,7 @@ If you only have a single layout in your application, we recommend using [`app/a
137
137
 
138
138
  ::
139
139
 
140
- If you want to create more layouts and learn how to use them in your pages, find more information in the [Layouts section](/docs/4.x/guide/directory-structure/app/layouts).
140
+ If you want to create more layouts and learn how to use them in your pages, find more information in the [Layouts section](/docs/4.x/directory-structure/app/layouts).
141
141
 
142
142
  ## Advanced: Extending the HTML Template
143
143
 
@@ -6,14 +6,14 @@ navigation.icon: i-lucide-image
6
6
 
7
7
  Nuxt uses two directories to handle assets like stylesheets, fonts or images.
8
8
 
9
- - The [`public/`](/docs/4.x/guide/directory-structure/public) directory content is served at the server root as-is.
10
- - The [`app/assets/`](/docs/4.x/guide/directory-structure/app/assets) directory contains by convention every asset that you want the build tool (Vite or webpack) to process.
9
+ - The [`public/`](/docs/4.x/directory-structure/public) directory content is served at the server root as-is.
10
+ - The [`app/assets/`](/docs/4.x/directory-structure/app/assets) directory contains by convention every asset that you want the build tool (Vite or webpack) to process.
11
11
 
12
12
  ## Public Directory
13
13
 
14
- The [`public/`](/docs/4.x/guide/directory-structure/public) directory is used as a public server for static assets publicly available at a defined URL of your application.
14
+ The [`public/`](/docs/4.x/directory-structure/public) directory is used as a public server for static assets publicly available at a defined URL of your application.
15
15
 
16
- You can get a file in the [`public/`](/docs/4.x/guide/directory-structure/public) directory from your application's code or from a browser by the root URL `/`.
16
+ You can get a file in the [`public/`](/docs/4.x/directory-structure/public) directory from your application's code or from a browser by the root URL `/`.
17
17
 
18
18
  ### Example
19
19
 
@@ -30,11 +30,11 @@ For example, referencing an image file in the `public/img/` directory, available
30
30
 
31
31
  ## Assets Directory
32
32
 
33
- Nuxt uses [Vite](https://vite.dev/guide/assets.html) (default) or [webpack](https://webpack.js.org/guides/asset-management) to build and bundle your application. The main function of these build tools is to process JavaScript files, but they can be extended through [plugins](https://vite.dev/plugins) (for Vite) or [loaders](https://webpack.js.org/loaders) (for webpack) to process other kinds of assets, like stylesheets, fonts or SVGs. This step transforms the original file, mainly for performance or caching purposes (such as stylesheet minification or browser cache invalidation).
33
+ Nuxt uses [Vite](https://vite.dev/guide/assets) (default) or [webpack](https://webpack.js.org/guides/asset-management/) to build and bundle your application. The main function of these build tools is to process JavaScript files, but they can be extended through [plugins](https://vite.dev/plugins/) (for Vite) or [loaders](https://webpack.js.org/loaders/) (for webpack) to process other kinds of assets, like stylesheets, fonts or SVGs. This step transforms the original file, mainly for performance or caching purposes (such as stylesheet minification or browser cache invalidation).
34
34
 
35
- By convention, Nuxt uses the [`app/assets/`](/docs/4.x/guide/directory-structure/app/assets) directory to store these files but there is no auto-scan functionality for this directory, and you can use any other name for it.
35
+ By convention, Nuxt uses the [`app/assets/`](/docs/4.x/directory-structure/app/assets) directory to store these files but there is no auto-scan functionality for this directory, and you can use any other name for it.
36
36
 
37
- In your application's code, you can reference a file located in the [`app/assets/`](/docs/4.x/guide/directory-structure/app/assets) directory by using the `~/assets/` path.
37
+ In your application's code, you can reference a file located in the [`app/assets/`](/docs/4.x/directory-structure/app/assets) directory by using the `~/assets/` path.
38
38
 
39
39
  ### Example
40
40
 
@@ -50,5 +50,5 @@ For example, referencing an image file that will be processed if a build tool is
50
50
  ```
51
51
 
52
52
  ::note
53
- Nuxt won't serve files in the [`app/assets/`](/docs/4.x/guide/directory-structure/app/assets) directory at a static URL like `/assets/my-file.png`. If you need a static URL, use the [`public/`](/docs/4.x/getting-started/assets#public-directory) directory.
53
+ Nuxt won't serve files in the [`app/assets/`](/docs/4.x/directory-structure/app/assets) directory at a static URL like `/assets/my-file.png`. If you need a static URL, use the [`public/`](/docs/4.x/getting-started/assets#public-directory) directory.
54
54
  ::
@@ -9,12 +9,12 @@ You can use CSS preprocessors, CSS frameworks, UI libraries and Nuxt modules to
9
9
 
10
10
  ## Local Stylesheets
11
11
 
12
- If you're writing local stylesheets, the natural place to put them is the [`app/assets/` directory](/docs/4.x/guide/directory-structure/app/assets).
12
+ If you're writing local stylesheets, the natural place to put them is the [`app/assets/` directory](/docs/4.x/directory-structure/app/assets).
13
13
 
14
14
  ### Importing Within Components
15
15
 
16
16
  You can import stylesheets in your pages, layouts and components directly.
17
- You can use a JavaScript import, or a CSS [`@import` statement](https://developer.mozilla.org/en-US/docs/Web/CSS/@import).
17
+ You can use a JavaScript import, or a CSS [`@import` statement](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@import).
18
18
 
19
19
  ```vue [app/pages/index.vue]
20
20
  <script>
@@ -37,7 +37,7 @@ The stylesheets will be inlined in the HTML rendered by Nuxt.
37
37
  ### The CSS Property
38
38
 
39
39
  You can also use the `css` property in the Nuxt configuration.
40
- The natural place for your stylesheets is the [`app/assets/` directory](/docs/4.x/guide/directory-structure/app/assets). You can then reference its path and Nuxt will include it to all the pages of your application.
40
+ The natural place for your stylesheets is the [`app/assets/` directory](/docs/4.x/directory-structure/app/assets). You can then reference its path and Nuxt will include it to all the pages of your application.
41
41
 
42
42
  ```ts [nuxt.config.ts]
43
43
  export default defineNuxtConfig({
@@ -163,7 +163,7 @@ export default defineNitroPlugin((nitro) => {
163
163
  })
164
164
  ```
165
165
 
166
- External stylesheets are render-blocking resources: they must be loaded and processed before the browser renders the page. Web pages that contain unnecessarily large styles take longer to render. You can read more about it on [web.dev](https://web.dev/defer-non-critical-css).
166
+ External stylesheets are render-blocking resources: they must be loaded and processed before the browser renders the page. Web pages that contain unnecessarily large styles take longer to render. You can read more about it on [web.dev](https://web.dev/articles/defer-non-critical-css).
167
167
 
168
168
  ## Using Preprocessors
169
169
 
@@ -206,7 +206,7 @@ export default defineNuxtConfig({
206
206
  In both cases, the compiled stylesheets will be inlined in the HTML rendered by Nuxt.
207
207
  ::
208
208
 
209
- If you need to inject code in pre-processed files, like a [Sass partial](https://sass-lang.com/documentation/at-rules/use#partials) with color variables, you can do so with the Vite [preprocessors options](https://vite.dev/config/shared-options.html#css-preprocessoroptions).
209
+ If you need to inject code in pre-processed files, like a [Sass partial](https://sass-lang.com/documentation/at-rules/use/#partials) with color variables, you can do so with the Vite [preprocessors options](https://vite.dev/config/shared-options#css-preprocessoroptions).
210
210
 
211
211
  Create some partials in your `app/assets` directory:
212
212
 
@@ -258,11 +258,11 @@ export default defineNuxtConfig({
258
258
 
259
259
  ::
260
260
 
261
- Nuxt uses Vite by default. If you wish to use webpack instead, refer to each preprocessor loader [documentation](https://webpack.js.org/loaders/sass-loader).
261
+ Nuxt uses Vite by default. If you wish to use webpack instead, refer to each preprocessor loader [documentation](https://webpack.js.org/loaders/sass-loader/).
262
262
 
263
263
  ### Preprocessor Workers (Experimental)
264
264
 
265
- Vite has made available an [experimental option](https://vite.dev/config/shared-options.html#css-preprocessormaxworkers) which can speed up using preprocessors.
265
+ Vite has made available an [experimental option](https://vite.dev/config/shared-options#css-preprocessormaxworkers) which can speed up using preprocessors.
266
266
 
267
267
  You can enable this in your `nuxt.config`:
268
268
 
@@ -284,7 +284,7 @@ This is an experimental option and you should refer to the Vite documentation an
284
284
 
285
285
  One of the best things about Vue and SFC is how great it is at naturally dealing with styling. You can directly write CSS or preprocessor code in the style block of your components file, therefore you will have fantastic developer experience without having to use something like CSS-in-JS. However if you wish to use CSS-in-JS, you can find 3rd party libraries and modules that support it, such as [pinceau](https://github.com/Tahul/pinceau).
286
286
 
287
- You can refer to the [Vue docs](https://vuejs.org/api/sfc-css-features.html) for a comprehensive reference about styling components in SFC.
287
+ You can refer to the [Vue docs](https://vuejs.org/api/sfc-css-features) for a comprehensive reference about styling components in SFC.
288
288
 
289
289
  ### Class And Style Bindings
290
290
 
@@ -354,7 +354,7 @@ const styleObject = reactive({ color: 'red', fontSize: '13px' })
354
354
 
355
355
  ::
356
356
 
357
- Refer to the [Vue docs](https://vuejs.org/guide/essentials/class-and-style.html) for more information.
357
+ Refer to the [Vue docs](https://vuejs.org/guide/essentials/class-and-style) for more information.
358
358
 
359
359
  ### Dynamic Styles With `v-bind`
360
360
 
@@ -447,7 +447,7 @@ SFC style blocks support preprocessor syntax. Vite comes with built-in support f
447
447
 
448
448
  ::
449
449
 
450
- You can refer to the [Vite CSS docs](https://vite.dev/guide/features.html#css) and the [@vitejs/plugin-vue docs](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
450
+ You can refer to the [Vite CSS docs](https://vite.dev/guide/features#css) and the [@vitejs/plugin-vue docs](https://github.com/vitejs/vite-plugin-vue/tree/main/packages/plugin-vue).
451
451
  For webpack users, refer to the [vue loader docs](https://vue-loader.vuejs.org).
452
452
 
453
453
  ## Using PostCSS
@@ -478,7 +478,7 @@ By default, Nuxt comes with the following plugins already pre-configured:
478
478
  - [postcss-import](https://github.com/postcss/postcss-import): Improves the `@import` rule
479
479
  - [postcss-url](https://github.com/postcss/postcss-url): Transforms `url()` statements
480
480
  - [autoprefixer](https://github.com/postcss/autoprefixer): Automatically adds vendor prefixes
481
- - [cssnano](https://cssnano.github.io/cssnano): Minification and purge
481
+ - [cssnano](https://cssnano.github.io/cssnano/): Minification and purge
482
482
 
483
483
  ## Leveraging Layouts For Multiple Styles
484
484
 
@@ -500,7 +500,7 @@ Use different styles for different layouts.
500
500
  </style>
501
501
  ```
502
502
 
503
- :read-more{to="/docs/4.x/guide/directory-structure/app/layouts"}
503
+ :read-more{to="/docs/4.x/directory-structure/app/layouts"}
504
504
 
505
505
  ## Third Party Libraries And Modules
506
506
 
@@ -517,7 +517,7 @@ Here are a few modules to help you get started:
517
517
  - [Nuxt UI](https://ui.nuxt.com): A UI Library for Modern Web Apps
518
518
  - [Panda CSS](https://panda-css.com/docs/installation/nuxt): CSS-in-JS engine that generates atomic CSS at build time
519
519
 
520
- Nuxt modules provide you with a good developer experience out of the box, but remember that if your favorite tool doesn't have a module, it doesn't mean that you can't use it with Nuxt! You can configure it yourself for your own project. Depending on the tool, you might need to use a [Nuxt plugin](/docs/4.x/guide/directory-structure/plugins) and/or [make your own module](/docs/4.x/guide/going-further/modules). Share them with the [community](/modules) if you do!
520
+ Nuxt modules provide you with a good developer experience out of the box, but remember that if your favorite tool doesn't have a module, it doesn't mean that you can't use it with Nuxt! You can configure it yourself for your own project. Depending on the tool, you might need to use a [Nuxt plugin](/docs/4.x/directory-structure/app/plugins) and/or [make your own module](/docs/4.x/guide/modules). Share them with the [community](/modules) if you do!
521
521
 
522
522
  ### Easily Load Webfonts
523
523
 
@@ -535,7 +535,7 @@ Nuxt comes with the same `<Transition>` element that Vue has, and also has suppo
535
535
 
536
536
  ### Font Advanced Optimization
537
537
 
538
- We would recommend using [Fontaine](https://github.com/nuxt-modules/fontaine) to reduce your [CLS](https://web.dev/cls). If you need something more advanced, consider creating a Nuxt module to extend the build process or the Nuxt runtime.
538
+ We would recommend using [Fontaine](https://github.com/nuxt-modules/fontaine) to reduce your [CLS](https://web.dev/articles/cls). If you need something more advanced, consider creating a Nuxt module to extend the build process or the Nuxt runtime.
539
539
 
540
540
  ::tip
541
541
  Always remember to take advantage of the various tools and techniques available in the Web ecosystem at large to make styling your application easier and more efficient. Whether you're using native CSS, a preprocessor, postcss, a UI library or a module, Nuxt has got you covered. Happy styling!
@@ -551,7 +551,7 @@ You can do the following to speed-up the download of your global CSS files:
551
551
  - Host your assets on the same domain (do not use a different subdomain)
552
552
 
553
553
  Most of these things should be done for you automatically if you're using modern platforms like Cloudflare, Netlify or Vercel.
554
- You can find an LCP optimization guide on [web.dev](https://web.dev/optimize-lcp).
554
+ You can find an LCP optimization guide on [web.dev](https://web.dev/articles/optimize-lcp).
555
555
 
556
556
  If all of your CSS is inlined by Nuxt, you can (experimentally) completely stop external CSS files from being referenced in your rendered HTML.
557
557
  You can achieve that with a hook, that you can place in a module, or in your Nuxt configuration file.
@@ -4,11 +4,11 @@ description: Nuxt file-system routing creates a route for every file in the page
4
4
  navigation.icon: i-lucide-milestone
5
5
  ---
6
6
 
7
- One core feature of Nuxt is the file system router. Every Vue file inside the [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory creates a corresponding URL (or route) that displays the contents of the file. By using dynamic imports for each page, Nuxt leverages code-splitting to ship the minimum amount of JavaScript for the requested route.
7
+ One core feature of Nuxt is the file system router. Every Vue file inside the [`app/pages/`](/docs/4.x/directory-structure/app/pages) directory creates a corresponding URL (or route) that displays the contents of the file. By using dynamic imports for each page, Nuxt leverages code-splitting to ship the minimum amount of JavaScript for the requested route.
8
8
 
9
9
  ## Pages
10
10
 
11
- Nuxt routing is based on [vue-router](https://router.vuejs.org) and generates the routes from every component created in the [`app/pages/` directory](/docs/4.x/guide/directory-structure/app/pages), based on their filename.
11
+ Nuxt routing is based on [vue-router](https://router.vuejs.org) and generates the routes from every component created in the [`app/pages/` directory](/docs/4.x/directory-structure/app/pages), based on their filename.
12
12
 
13
13
  This file system routing uses naming conventions to create dynamic and nested routes:
14
14
 
@@ -43,7 +43,7 @@ This file system routing uses naming conventions to create dynamic and nested ro
43
43
 
44
44
  ::
45
45
 
46
- :read-more{to="/docs/4.x/guide/directory-structure/app/pages"}
46
+ :read-more{to="/docs/4.x/directory-structure/app/pages"}
47
47
 
48
48
  ## Navigation
49
49
 
@@ -90,11 +90,15 @@ Nuxt provides a customizable route middleware framework you can use throughout y
90
90
  Route middleware runs within the Vue part of your Nuxt app. Despite the similar name, they are completely different from server middleware, which are run in the Nitro server part of your app.
91
91
  ::
92
92
 
93
+ ::important
94
+ Route middleware does **not** run for server routes (e.g. `/api/*`) or other server requests. To apply middleware to these requests, use [server middleware](/docs/4.x/directory-structure/server#server-middleware) instead.
95
+ ::
96
+
93
97
  There are three kinds of route middleware:
94
98
 
95
99
  1. Anonymous (or inline) route middleware, which are defined directly in the pages where they are used.
96
- 2. Named route middleware, which are placed in the [`app/middleware/`](/docs/4.x/guide/directory-structure/app/middleware) directory and will be automatically loaded via asynchronous import when used on a page. (**Note**: The route middleware name is normalized to kebab-case, so `someMiddleware` becomes `some-middleware`.)
97
- 3. Global route middleware, which are placed in the [`app/middleware/`](/docs/4.x/guide/directory-structure/app/middleware) directory (with a `.global` suffix) and will be automatically run on every route change.
100
+ 2. Named route middleware, which are placed in the [`app/middleware/`](/docs/4.x/directory-structure/app/middleware) directory and will be automatically loaded via asynchronous import when used on a page. (**Note**: The route middleware name is normalized to kebab-case, so `someMiddleware` becomes `some-middleware`.)
101
+ 3. Global route middleware, which are placed in the [`app/middleware/`](/docs/4.x/directory-structure/app/middleware) directory (with a `.global` suffix) and will be automatically run on every route change.
98
102
 
99
103
  Example of an `auth` middleware protecting the `/dashboard` page:
100
104
 
@@ -125,7 +129,7 @@ definePageMeta({
125
129
 
126
130
  ::
127
131
 
128
- :read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
132
+ :read-more{to="/docs/4.x/directory-structure/app/middleware"}
129
133
 
130
134
  ## Route Validation
131
135
 
@@ -9,7 +9,7 @@ and numerous configuration options to manage your app's head and SEO meta tags.
9
9
 
10
10
  ## Nuxt Config
11
11
 
12
- Providing an [`app.head`](/docs/4.x/api/nuxt-config#head) property in your [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) allows you to statically customize the head for your entire app.
12
+ Providing an [`app.head`](/docs/4.x/api/nuxt-config#head) property in your [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) allows you to statically customize the head for your entire app.
13
13
 
14
14
  ::important
15
15
  This method does not allow you to provide reactive data. We recommend using `useHead()` in `app.vue`.
@@ -273,7 +273,7 @@ useHead({
273
273
 
274
274
  ### With `definePageMeta`
275
275
 
276
- Within your [`app/pages/` directory](/docs/4.x/guide/directory-structure/app/pages), you can use `definePageMeta` along with [`useHead`](/docs/4.x/api/composables/use-head) to set metadata based on the current route.
276
+ Within your [`app/pages/` directory](/docs/4.x/directory-structure/app/pages), you can use `definePageMeta` along with [`useHead`](/docs/4.x/api/composables/use-head) to set metadata based on the current route.
277
277
 
278
278
  For example, you can first set the current page title (this is extracted at build time via a macro, so it can't be set dynamically):
279
279
 
@@ -299,7 +299,7 @@ useHead({
299
299
 
300
300
  :link-example{to="/docs/4.x/examples/features/meta-tags"}
301
301
 
302
- :read-more{to="/docs/4.x/guide/directory-structure/app/pages/#page-metadata"}
302
+ :read-more{to="/docs/4.x/directory-structure/app/pages/#page-metadata"}
303
303
 
304
304
  ### Dynamic Title
305
305
 
@@ -5,12 +5,12 @@ navigation.icon: i-lucide-toggle-right
5
5
  ---
6
6
 
7
7
  ::note
8
- Nuxt leverages Vue's [`<Transition>`](https://vuejs.org/guide/built-ins/transition.html#the-transition-component) component to apply transitions between pages and layouts.
8
+ Nuxt leverages Vue's [`<Transition>`](https://vuejs.org/guide/built-ins/transition#the-transition-component) component to apply transitions between pages and layouts.
9
9
  ::
10
10
 
11
11
  ## Page Transitions
12
12
 
13
- You can enable page transitions to apply an automatic transition for all your [pages](/docs/4.x/guide/directory-structure/app/pages).
13
+ You can enable page transitions to apply an automatic transition for all your [pages](/docs/4.x/directory-structure/app/pages).
14
14
 
15
15
  ```ts twoslash [nuxt.config.ts]
16
16
  export default defineNuxtConfig({
@@ -24,7 +24,7 @@ export default defineNuxtConfig({
24
24
  If you are changing layouts as well as page, the page transition you set here will not run. Instead, you should set a [layout transition](/docs/4.x/getting-started/transitions#layout-transitions).
25
25
  ::
26
26
 
27
- To start adding transition between your pages, add the following CSS to your [`app.vue`](/docs/4.x/guide/directory-structure/app):
27
+ To start adding transition between your pages, add the following CSS to your [`app.vue`](/docs/4.x/directory-structure/app/app):
28
28
 
29
29
  ::code-group
30
30
 
@@ -115,7 +115,7 @@ Moving to the about page will add the 3d rotation effect:
115
115
 
116
116
  ## Layout Transitions
117
117
 
118
- You can enable layout transitions to apply an automatic transition for all your [layouts](/docs/4.x/guide/directory-structure/app/layouts).
118
+ You can enable layout transitions to apply an automatic transition for all your [layouts](/docs/4.x/directory-structure/app/layouts).
119
119
 
120
120
  ```ts twoslash [nuxt.config.ts]
121
121
  export default defineNuxtConfig({
@@ -125,7 +125,7 @@ export default defineNuxtConfig({
125
125
  })
126
126
  ```
127
127
 
128
- To start adding transition between your pages and layouts, add the following CSS to your [`app.vue`](/docs/4.x/guide/directory-structure/app):
128
+ To start adding transition between your pages and layouts, add the following CSS to your [`app.vue`](/docs/4.x/directory-structure/app/app):
129
129
 
130
130
  ::code-group
131
131
 
@@ -229,7 +229,7 @@ definePageMeta({
229
229
 
230
230
  You can customize these default transition names globally using `nuxt.config`.
231
231
 
232
- Both `pageTransition` and `layoutTransition` keys accept [`TransitionProps`](https://vuejs.org/api/built-in-components.html#transition) as JSON serializable values where you can pass the `name`, `mode` and other valid transition-props of the custom CSS transition.
232
+ Both `pageTransition` and `layoutTransition` keys accept [`TransitionProps`](https://vuejs.org/api/built-in-components#transition) as JSON serializable values where you can pass the `name`, `mode` and other valid transition-props of the custom CSS transition.
233
233
 
234
234
  ```ts twoslash [nuxt.config.ts]
235
235
  export default defineNuxtConfig({
@@ -310,12 +310,12 @@ definePageMeta({
310
310
  ```
311
311
 
312
312
  ::tip
313
- Learn more about additional [JavaScript hooks](https://vuejs.org/guide/built-ins/transition.html#javascript-hooks) available in the `Transition` component.
313
+ Learn more about additional [JavaScript hooks](https://vuejs.org/guide/built-ins/transition#javascript-hooks) available in the `Transition` component.
314
314
  ::
315
315
 
316
316
  ## Dynamic Transitions
317
317
 
318
- To apply dynamic transitions using conditional logic, you can leverage inline [middleware](/docs/4.x/guide/directory-structure/app/middleware) to assign a different transition name to `to.meta.pageTransition`.
318
+ To apply dynamic transitions using conditional logic, you can leverage inline [middleware](/docs/4.x/directory-structure/app/middleware) to assign a different transition name to `to.meta.pageTransition`.
319
319
 
320
320
  ::code-group
321
321
 
@@ -416,7 +416,7 @@ Remember, this page transition cannot be overridden with `definePageMeta` on ind
416
416
 
417
417
  ## View Transitions API (experimental)
418
418
 
419
- Nuxt ships with an experimental implementation of the [**View Transitions API**](https://developer.chrome.com/docs/web-platform/view-transitions) (see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)). This is an exciting new way to implement native browser transitions which (among other things) have the ability to transition between unrelated elements on different pages.
419
+ Nuxt ships with an experimental implementation of the [**View Transitions API**](https://developer.chrome.com/docs/web-platform/view-transitions) (see [MDN](https://developer.mozilla.org/en-US/docs/Web/API/View_Transition_API)). This is an exciting new way to implement native browser transitions which (among other things) have the ability to transition between unrelated elements on different pages.
420
420
 
421
421
  You can check a demo [on StackBlitz](https://stackblitz.com/edit/nuxt-view-transitions).
422
422
 
@@ -434,7 +434,7 @@ The possible values are: `false`, `true`, or `'always'`.
434
434
 
435
435
  If set to true, Nuxt will not apply transitions if the user's browser matches `prefers-reduced-motion: reduce` (recommended). If set to `always`, Nuxt will always apply the transition and it is up to you to respect the user's preference.
436
436
 
437
- By default, view transitions are enabled for all [pages](/docs/4.x/guide/directory-structure/app/pages), but you can set a different global default.
437
+ By default, view transitions are enabled for all [pages](/docs/4.x/directory-structure/app/pages), but you can set a different global default.
438
438
 
439
439
  ```ts twoslash [nuxt.config.ts]
440
440
  export default defineNuxtConfig({
@@ -194,10 +194,10 @@ The `useAsyncData` composable is a great way to wrap and wait for multiple `$fet
194
194
 
195
195
  ```vue
196
196
  <script setup lang="ts">
197
- const { data: discounts, status } = await useAsyncData('cart-discount', async () => {
197
+ const { data: discounts, status } = await useAsyncData('cart-discount', async (_nuxtApp, { signal }) => {
198
198
  const [coupons, offers] = await Promise.all([
199
- $fetch('/cart/coupons'),
200
- $fetch('/cart/offers'),
199
+ $fetch('/cart/coupons', { signal }),
200
+ $fetch('/cart/offers', { signal }),
201
201
  ])
202
202
 
203
203
  return { coupons, offers }
@@ -372,8 +372,8 @@ The following options **must be consistent** across all calls with the same key:
372
372
 
373
373
  ```ts
374
374
  // ❌ This will trigger a development warning
375
- const { data: users1 } = useAsyncData('users', () => $fetch('/api/users'), { deep: false })
376
- const { data: users2 } = useAsyncData('users', () => $fetch('/api/users'), { deep: true })
375
+ const { data: users1 } = useAsyncData('users', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }), { deep: false })
376
+ const { data: users2 } = useAsyncData('users', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }), { deep: true })
377
377
  ```
378
378
 
379
379
  The following options **can safely differ** without triggering warnings:
@@ -385,16 +385,16 @@ The following options **can safely differ** without triggering warnings:
385
385
 
386
386
  ```ts
387
387
  // ✅ This is allowed
388
- const { data: users1 } = useAsyncData('users', () => $fetch('/api/users'), { immediate: true })
389
- const { data: users2 } = useAsyncData('users', () => $fetch('/api/users'), { immediate: false })
388
+ const { data: users1 } = useAsyncData('users', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }), { immediate: true })
389
+ const { data: users2 } = useAsyncData('users', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }), { immediate: false })
390
390
  ```
391
391
 
392
392
  If you need independent instances, use different keys:
393
393
 
394
394
  ```ts
395
395
  // These are completely independent instances
396
- const { data: users1 } = useAsyncData('users-1', () => $fetch('/api/users'))
397
- const { data: users2 } = useAsyncData('users-2', () => $fetch('/api/users'))
396
+ const { data: users1 } = useAsyncData('users-1', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }))
397
+ const { data: users2 } = useAsyncData('users-2', (_nuxtApp, { signal }) => $fetch('/api/users', { signal }))
398
398
  ```
399
399
 
400
400
  #### Reactive Keys
@@ -516,7 +516,7 @@ const { data, status } = useLazyFetch('/api/user', {
516
516
  </script>
517
517
  ```
518
518
 
519
- 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.
519
+ In the case of more complex URL construction, you may use a callback as a [computed getter](https://vuejs.org/guide/essentials/computed) that returns the URL string.
520
520
 
521
521
  Every time a dependency changes, the data will be fetched using the newly constructed URL. Combine this with [not-immediate](/docs/4.x/getting-started/data-fetching#not-immediate), and you can wait until the reactive element changes before fetching.
522
522
 
@@ -661,7 +661,7 @@ Using `<script setup>` or `<script setup lang="ts">` are the recommended way of
661
661
 
662
662
  ## Serializing Data From Server to Client
663
663
 
664
- 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.
664
+ 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/sveltejs/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.
665
665
 
666
666
  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.
667
667
 
@@ -733,7 +733,7 @@ const { data } = await useFetch('/api/bar')
733
733
 
734
734
  Nuxt does not currently support an alternative serializer to `JSON.stringify`. However, you can return your payload as a normal string and utilize the `toJSON` method to maintain type safety.
735
735
 
736
- In the example below, we use [superjson](https://github.com/blitz-js/superjson) as our serializer.
736
+ In the example below, we use [superjson](https://github.com/flightcontrolhq/superjson) as our serializer.
737
737
 
738
738
  ```ts [server/api/superjson.ts]
739
739
  import superjson from 'superjson'
@@ -771,7 +771,7 @@ const { data } = await useFetch('/api/superjson', {
771
771
  ### Consuming SSE (Server-Sent Events) via POST request
772
772
 
773
773
  ::tip
774
- If you're consuming SSE via GET request, you can use [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) or VueUse composable [`useEventSource`](https://vueuse.org/core/useEventSource/).
774
+ If you're consuming SSE via GET request, you can use [`EventSource`](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) or VueUse composable [`useEventSource`](https://vueuse.org/core/useeventsource/).
775
775
  ::
776
776
 
777
777
  When consuming SSE via POST request, you need to handle the connection manually. Here's how you can do it:
@@ -804,10 +804,10 @@ while (true) {
804
804
  When requests don't rely on each other, you can make them in parallel with `Promise.all()` to boost performance.
805
805
 
806
806
  ```ts
807
- const { data } = await useAsyncData(() => {
807
+ const { data } = await useAsyncData((_nuxtApp, { signal }) => {
808
808
  return Promise.all([
809
- $fetch('/api/comments/'),
810
- $fetch('/api/author/12'),
809
+ $fetch('/api/comments/', { signal }),
810
+ $fetch('/api/author/12', { signal }),
811
811
  ])
812
812
  })
813
813