@nuxt/docs-nightly 4.3.0-29356103.2f7957ac → 4.3.0-29430616.754c35a4

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
@@ -44,7 +44,7 @@ const handleClick = () => {
44
44
 
45
45
  On the initial request, the `counter` ref is initialized in the server since it is rendered inside the `<p>` tag. The contents of `handleClick` is never executed here. During hydration in the browser, the `counter` ref is re-initialized. The `handleClick` finally binds itself to the button; Therefore it is reasonable to deduce that the body of `handleClick` will always run in a browser environment.
46
46
 
47
- [Middlewares](/docs/4.x/guide/directory-structure/app/middleware) and [pages](/docs/4.x/guide/directory-structure/app/pages) run in the server and on the client during hydration. [Plugins](/docs/4.x/guide/directory-structure/plugins) can be rendered on the server or client or both. [Components](/docs/4.x/guide/directory-structure/app/components) can be forced to run on the client only as well. [Composables](/docs/4.x/guide/directory-structure/app/composables) and [utilities](/docs/4.x/guide/directory-structure/app/utils) are rendered based on the context of their usage.
47
+ [Middlewares](/docs/4.x/directory-structure/app/middleware) and [pages](/docs/4.x/directory-structure/app/pages) run in the server and on the client during hydration. [Plugins](/docs/4.x/directory-structure/app/plugins) can be rendered on the server or client or both. [Components](/docs/4.x/directory-structure/app/components) can be forced to run on the client only as well. [Composables](/docs/4.x/directory-structure/app/composables) and [utilities](/docs/4.x/directory-structure/app/utils) are rendered based on the context of their usage.
48
48
 
49
49
  **Benefits of server-side rendering:**
50
50
  - **Performance**: Users can get immediate access to the page's content because browsers can display static content much faster than JavaScript-generated content. At the same time, Nuxt preserves the interactivity of a web application during the hydration process.
@@ -57,7 +57,7 @@ On the initial request, the `counter` ref is initialized in the server since it
57
57
  Universal rendering is very versatile and can fit almost any use case, and is especially appropriate for any content-oriented websites: **blogs, marketing websites, portfolios, e-commerce sites, and marketplaces.**
58
58
 
59
59
  ::tip
60
- For more examples about writing Vue code without hydration mismatch, see [the Vue docs](https://vuejs.org/guide/scaling-up/ssr.html#hydration-mismatch).
60
+ For more examples about writing Vue code without hydration mismatch, see [the Vue docs](https://vuejs.org/guide/scaling-up/ssr#hydration-mismatch).
61
61
  ::
62
62
 
63
63
  ::important
@@ -225,33 +225,7 @@ Edge-side rendering is possible thanks to [Nitro](https://nitro.build/), the [se
225
225
 
226
226
  The current platforms where you can leverage ESR are:
227
227
  - [Cloudflare Pages](https://pages.cloudflare.com) with zero configuration using the git integration and the `nuxt build` command
228
- - [Vercel Edge Functions](https://vercel.com/features/edge-functions) using the `nuxt build` command and `NITRO_PRESET=vercel-edge` environment variable
229
- - [Netlify Edge Functions](https://www.netlify.com/products/#netlify-edge-functions) using the `nuxt build` command and `NITRO_PRESET=netlify-edge` environment variable
228
+ - [Vercel Cloud](https://vercel.com/home) using the `nuxt build` command and `NITRO_PRESET=vercel-edge` environment variable
229
+ - [Netlify Edge Functions](https://www.netlify.com/platform/#netlify-edge-functions) using the `nuxt build` command and `NITRO_PRESET=netlify-edge` environment variable
230
230
 
231
231
  Note that **Hybrid Rendering** can be used when using Edge-Side Rendering with route rules.
232
-
233
- You can explore open source examples deployed on some of the platform mentioned above:
234
- ::card-group
235
- ::card
236
- ---
237
- icon: i-simple-icons-github
238
- title: Nuxt Todos Edge
239
- to: https://github.com/atinux/nuxt-todos-edge
240
- target: _blank
241
- ui.icon.base: text-black dark:text-white
242
- ---
243
- A todos application with user authentication, SSR and SQLite.
244
- ::
245
- ::card
246
- ---
247
- icon: i-simple-icons-github
248
- title: Atinotes
249
- to: https://github.com/atinux/atinotes
250
- target: _blank
251
- ui.icon.base: text-black dark:text-white
252
- ---
253
- An editable website with universal rendering based on Cloudflare KV.
254
- ::
255
- ::
256
-
257
- <!-- TODO: link to templates with ESR category for examples -->
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: 'Vue.js Development'
3
3
  description: "Nuxt uses Vue.js and adds features such as component auto-imports, file-based routing and composables for an SSR-friendly usage."
4
+ navigation: false
4
5
  ---
5
6
 
6
7
  Nuxt integrates Vue 3, the new major release of Vue that enables new patterns for Nuxt users.
@@ -21,17 +22,17 @@ We chose to build Nuxt on top of Vue for these reasons:
21
22
 
22
23
  ### Single File Components
23
24
 
24
- [Vue’s single-file components](https://vuejs.org/guide/scaling-up/sfc.html) (SFC or `*.vue` files) encapsulate the markup (`<template>`), logic (`<script>`) and styling (`<style>`) of a Vue component. Nuxt provides a zero-config experience for SFCs with [Hot Module Replacement](https://vite.dev/guide/features.html#hot-module-replacement) that offers a seamless developer experience.
25
+ [Vue’s single-file components](https://vuejs.org/guide/scaling-up/sfc) (SFC or `*.vue` files) encapsulate the markup (`<template>`), logic (`<script>`) and styling (`<style>`) of a Vue component. Nuxt provides a zero-config experience for SFCs with [Hot Module Replacement](https://vite.dev/guide/features#hot-module-replacement) that offers a seamless developer experience.
25
26
 
26
27
  ### Auto-imports
27
28
 
28
- Every Vue component created in the [`app/components/`](/docs/4.x/guide/directory-structure/app/components) directory of a Nuxt project will be available in your project without having to import it. If a component is not used anywhere, your production’s code will not include it.
29
+ Every Vue component created in the [`app/components/`](/docs/4.x/directory-structure/app/components) directory of a Nuxt project will be available in your project without having to import it. If a component is not used anywhere, your production’s code will not include it.
29
30
 
30
31
  :read-more{to="/docs/4.x/guide/concepts/auto-imports"}
31
32
 
32
33
  ### Vue Router
33
34
 
34
- Most applications need multiple pages and a way to navigate between them. This is called **routing**. Nuxt uses an [`app/pages/`](/docs/4.x/guide/directory-structure/app/pages) directory and naming conventions to directly create routes mapped to your files using the official [Vue Router library](https://router.vuejs.org).
35
+ Most applications need multiple pages and a way to navigate between them. This is called **routing**. Nuxt uses an [`app/pages/`](/docs/4.x/directory-structure/app/pages) directory and naming conventions to directly create routes mapped to your files using the official [Vue Router library](https://router.vuejs.org).
35
36
 
36
37
  :read-more{to="/docs/4.x/getting-started/routing"}
37
38
 
@@ -78,7 +79,7 @@ export default {
78
79
  </script>
79
80
  ```
80
81
 
81
- The [Composition API](https://vuejs.org/guide/extras/composition-api-faq.html) introduced in Vue 3 is not a replacement of the Options API, but it enables better logic reuse throughout an application, and is a more natural way to group code by concern in complex components.
82
+ The [Composition API](https://vuejs.org/guide/extras/composition-api-faq) introduced in Vue 3 is not a replacement of the Options API, but it enables better logic reuse throughout an application, and is a more natural way to group code by concern in complex components.
82
83
 
83
84
  Used with the `setup` keyword in the `<script>` definition, here is the above component rewritten with Composition API and Nuxt 3’s auto-imported Reactivity APIs:
84
85
 
@@ -91,8 +92,8 @@ const increment = () => count.value++
91
92
 
92
93
  The goal of Nuxt is to provide a great developer experience around the Composition API.
93
94
 
94
- - Use auto-imported [Reactivity functions](https://vuejs.org/api/reactivity-core.html) from Vue and Nuxt [built-in composables](/docs/4.x/api/composables/use-async-data).
95
- - Write your own auto-imported reusable functions in the [`app/composables/` directory](/docs/4.x/guide/directory-structure/app/composables).
95
+ - Use auto-imported [Reactivity functions](https://vuejs.org/api/reactivity-core) from Vue and Nuxt [built-in composables](/docs/4.x/api/composables/use-async-data).
96
+ - Write your own auto-imported reusable functions in the [`app/composables/` directory](/docs/4.x/directory-structure/app/composables).
96
97
 
97
98
  ### TypeScript Support
98
99
 
@@ -5,15 +5,16 @@ description: "Understanding the lifecycle of Nuxt applications can help you gain
5
5
 
6
6
  The goal of this chapter is to provide a high-level overview of the different parts of the framework, their execution order, and how they work together.
7
7
 
8
- ## Server
8
+ ## Server lifecycle
9
9
 
10
10
  On the server, the following steps are executed for every initial request to your application:
11
11
 
12
- ### Step 1: Setup Nitro Server and Nitro Plugins (Once)
12
+ ::steps
13
+ ### Server plugins :badge[once]{color="info" class="align-middle"}
13
14
 
14
15
  Nuxt is powered by [Nitro](https://nitro.build/), a modern server engine.
15
16
 
16
- When Nitro starts, it initializes and executes the plugins under the `/server/plugins` directory. These plugins can:
17
+ When Nitro starts, it initializes and executes the plugins under the [`/server/plugins`](/docs/4.x/directory-structure/server#server-plugins) directory. These plugins can:
17
18
  - Capture and handle application-wide errors.
18
19
  - Register hooks that execute when Nitro shuts down.
19
20
  - Register hooks for request lifecycle events, such as modifying responses.
@@ -22,9 +23,9 @@ When Nitro starts, it initializes and executes the plugins under the `/server/pl
22
23
  Nitro plugins are executed only once when the server starts. In a serverless environment, the server boots on each incoming request, and so do the Nitro plugins. However, they are not awaited.
23
24
  ::
24
25
 
25
- :read-more{to="/docs/4.x/guide/directory-structure/server#server-plugins"}
26
+ :read-more{to="/docs/4.x/directory-structure/server#server-plugins"}
26
27
 
27
- ### Step 2: Nitro Server Middleware
28
+ ### Server middleware
28
29
 
29
30
  After initializing the Nitro server, middleware under `server/middleware/` is executed for every request. Middleware can be used for tasks such as authentication, logging, or request transformation.
30
31
 
@@ -32,23 +33,23 @@ After initializing the Nitro server, middleware under `server/middleware/` is ex
32
33
  Returning a value from middleware will terminate the request and send the returned value as the response. This behavior should generally be avoided to ensure proper request handling!
33
34
  ::
34
35
 
35
- :read-more{to="/docs/4.x/guide/directory-structure/server#server-middleware"}
36
+ :read-more{to="/docs/4.x/directory-structure/server#server-middleware"}
36
37
 
37
- ### Step 3: Initialize Nuxt and Execute Nuxt App Plugins
38
+ ### App plugins
38
39
 
39
- The Vue and Nuxt instances are created first. Afterward, Nuxt executes its server plugins. This includes:
40
+ The Vue and Nuxt instances are created first. Afterward, Nuxt executes its app plugins. This includes:
40
41
  - Built-in plugins, such as Vue Router and `unhead`.
41
42
  - Custom plugins located in the `app/plugins/` directory, including those without a suffix (e.g., `myPlugin.ts`) and those with the `.server` suffix (e.g., `myServerPlugin.server.ts`).
42
43
 
43
- Plugins execute in a specific order and may have dependencies on one another. For more details, including execution order and parallelism, refer to the [Plugins documentation](/docs/4.x/guide/directory-structure/plugins).
44
+ Plugins execute in a specific order and may have dependencies on one another. For more details, including execution order and parallelism, refer to the [Plugins documentation](/docs/4.x/directory-structure/app/plugins).
44
45
 
45
46
  ::callout{icon="i-lucide-lightbulb"}
46
47
  After this step, Nuxt calls the [`app:created`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook, which can be used to execute additional logic.
47
48
  ::
48
49
 
49
- :read-more{to="/docs/4.x/guide/directory-structure/plugins"}
50
+ :read-more{to="/docs/4.x/directory-structure/app/plugins"}
50
51
 
51
- ### Step 4: Route Validation
52
+ ### Route validation
52
53
 
53
54
  After initializing plugins and before executing middleware, Nuxt calls the `validate` method if it is defined in the `definePageMeta` function. The `validate` method, which can be synchronous or asynchronous, is often used to validate dynamic route parameters.
54
55
 
@@ -59,7 +60,7 @@ For more information, see the [Route Validation documentation](/docs/4.x/getting
59
60
 
60
61
  :read-more{to="/docs/4.x/getting-started/routing#route-validation"}
61
62
 
62
- ### Step 5: Execute Nuxt App Middleware
63
+ ### App middleware
63
64
 
64
65
  Middleware allows you to run code before navigating to a particular route. It is often used for tasks such as authentication, redirection, or logging.
65
66
 
@@ -70,13 +71,13 @@ In Nuxt, there are three types of middleware:
70
71
 
71
72
  Nuxt executes all global middleware on the initial page load (both on server and client) and then again before any client-side navigation. Named and anonymous middleware are executed only on the routes specified in the middleware property of the page(route) meta defined in the corresponding page components.
72
73
 
73
- For details about each type and examples, see the [Middleware documentation](/docs/4.x/guide/directory-structure/app/middleware).
74
+ For details about each type and examples, see the [Middleware documentation](/docs/4.x/directory-structure/app/middleware).
74
75
 
75
76
  Any redirection on the server will result in a `Location:` header being sent to the browser; the browser then makes a fresh request to this new location. All application state will be reset when this happens, unless persisted in a cookie.
76
77
 
77
- :read-more{to="/docs/4.x/guide/directory-structure/app/middleware"}
78
+ :read-more{to="/docs/4.x/directory-structure/app/middleware"}
78
79
 
79
- ### Step 6: Render Page and Components
80
+ ### Page and components
80
81
 
81
82
  Nuxt renders the page and its components and fetches any required data with `useFetch` and `useAsyncData` during this step. Since there are no dynamic updates and no DOM operations occur on the server, Vue lifecycle hooks such as `onBeforeMount`, `onMounted`, and subsequent hooks are **NOT** executed during SSR.
82
83
 
@@ -94,7 +95,7 @@ You should avoid code that produces side effects that need cleanup in root scope
94
95
  Watch a video from Daniel Roe explaining Server Rendering and Global State.
95
96
  ::
96
97
 
97
- ### Step 7: Generate HTML Output
98
+ ### HTML Output
98
99
 
99
100
  After all required data is fetched and the components are rendered, Nuxt combines the rendered components with settings from `unhead` to generate a complete HTML document. This HTML, along with the associated data, is then sent back to the client to complete the SSR process.
100
101
 
@@ -106,11 +107,15 @@ After rendering the Vue application to HTML, Nuxt calls the [`app:rendered`](/do
106
107
  Before finalizing and sending the HTML, Nitro will call the [`render:html`](/docs/4.x/api/advanced/hooks#nitro-app-hooks-runtime-server-side) hook. This hook allows you to manipulate the generated HTML, such as injecting additional scripts or modifying meta tags.
107
108
  ::
108
109
 
109
- ## Client (browser)
110
+ ::
111
+
112
+ ## Client lifecycle
110
113
 
111
114
  This part of the lifecycle is fully executed in the browser, no matter which Nuxt mode you've chosen.
112
115
 
113
- ### Step 1: Initialize Nuxt and Execute Nuxt App Plugins
116
+ ::steps
117
+
118
+ ### App plugins
114
119
 
115
120
  This step is similar to the server-side execution and includes both built-in and custom plugins.
116
121
 
@@ -120,21 +125,21 @@ Custom plugins in the `app/plugins/` directory, such as those without a suffix (
120
125
  After this step, Nuxt calls the [`app:created`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook, which can be used to execute additional logic.
121
126
  ::
122
127
 
123
- :read-more{to="/docs/4.x/guide/directory-structure/plugins"}
128
+ :read-more{to="/docs/4.x/directory-structure/app/plugins"}
124
129
 
125
- ### Step 2: Route Validation
130
+ ### Route validation
126
131
 
127
132
  This step is the same as the server-side execution and includes the `validate` method if defined in the `definePageMeta` function.
128
133
 
129
- ### Step 3: Execute Nuxt App Middleware
134
+ ### App middleware
130
135
 
131
136
  Nuxt middleware runs on both the server and the client. If you want certain code to run in specific environments, consider splitting it by using `import.meta.client` for the client and `import.meta.server` for the server.
132
137
 
133
- :read-more{to="/docs/4.x/guide/directory-structure/app/middleware#when-middleware-runs"}
138
+ :read-more{to="/docs/4.x/directory-structure/app/middleware#when-middleware-runs"}
134
139
 
135
- ### Step 4: Mount Vue Application and Hydration
140
+ ### Mount Vue app and hydrate
136
141
 
137
- Calling `app.mount('#__nuxt')` mounts the Vue application to the DOM. If the application uses SSR or SSG mode, Vue performs a hydration step to make the client-side application interactive. During hydration, Vue recreates the application (excluding [Server Components](/docs/4.x/guide/directory-structure/app/components#server-components)), matches each component to its corresponding DOM nodes, and attaches DOM event listeners.
142
+ Calling `app.mount('#__nuxt')` mounts the Vue application to the DOM. If the application uses SSR or SSG mode, Vue performs a hydration step to make the client-side application interactive. During hydration, Vue recreates the application (excluding [Server Components](/docs/4.x/directory-structure/app/components#server-components)), matches each component to its corresponding DOM nodes, and attaches DOM event listeners.
138
143
 
139
144
  To ensure proper hydration, it's important to maintain consistency between the data on the server and the client. For API requests, it is recommended to use `useAsyncData`, `useFetch`, or other SSR-friendly composables. These methods ensure that the data fetched on the server side is reused during hydration, avoiding repeated requests. Any new requests should only be triggered after hydration, preventing hydration errors.
140
145
 
@@ -146,6 +151,8 @@ Before mounting the Vue application, Nuxt calls the [`app:beforeMount`](/docs/4.
146
151
  After mounting the Vue application, Nuxt calls the [`app:mounted`](/docs/4.x/api/advanced/hooks#app-hooks-runtime) hook.
147
152
  ::
148
153
 
149
- ### Step 5: Vue Lifecycle
154
+ ### Vue lifecycle
150
155
 
151
156
  Unlike on the server, the browser executes the full [Vue lifecycle](https://vuejs.org/guide/essentials/lifecycle).
157
+
158
+ ::
@@ -3,7 +3,7 @@ title: Auto-imports
3
3
  description: "Nuxt auto-imports components, composables, helper functions and Vue APIs."
4
4
  ---
5
5
 
6
- Nuxt auto-imports components, composables and [Vue.js APIs](https://vuejs.org/api) to use across your application without explicitly importing them.
6
+ Nuxt auto-imports components, composables and [Vue.js APIs](https://vuejs.org/api/) to use across your application without explicitly importing them.
7
7
 
8
8
  ```vue twoslash [app/app.vue]
9
9
  <script setup lang="ts">
@@ -11,7 +11,7 @@ const count = ref(1) // ref is auto-imported
11
11
  </script>
12
12
  ```
13
13
 
14
- Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/4.x/guide/directory-structure/app/components), [`app/composables/`](/docs/4.x/guide/directory-structure/app/composables) and [`app/utils/`](/docs/4.x/guide/directory-structure/app/utils).
14
+ Thanks to its opinionated directory structure, Nuxt can auto-import your [`app/components/`](/docs/4.x/directory-structure/app/components), [`app/composables/`](/docs/4.x/directory-structure/app/composables) and [`app/utils/`](/docs/4.x/directory-structure/app/utils).
15
15
 
16
16
  Contrary to a classic global declaration, Nuxt preserves typings, IDEs completions and hints, and **only includes what is used in your production code**.
17
17
 
@@ -20,7 +20,7 @@ In the docs, every function that is not explicitly imported is auto-imported by
20
20
  ::
21
21
 
22
22
  ::note
23
- In the [`server`](/docs/4.x/guide/directory-structure/server) directory, Nuxt auto-imports exported functions and variables from `server/utils/`.
23
+ In the [`server`](/docs/4.x/directory-structure/server) directory, Nuxt auto-imports exported functions and variables from `server/utils/`.
24
24
  ::
25
25
 
26
26
  ::note
@@ -101,15 +101,15 @@ export const useMyComposable = () => {
101
101
 
102
102
  Nuxt directly auto-imports files created in defined directories:
103
103
 
104
- - `app/components/` for [Vue components](/docs/4.x/guide/directory-structure/app/components).
105
- - `app/composables/` for [Vue composables](/docs/4.x/guide/directory-structure/app/composables).
104
+ - `app/components/` for [Vue components](/docs/4.x/directory-structure/app/components).
105
+ - `app/composables/` for [Vue composables](/docs/4.x/directory-structure/app/composables).
106
106
  - `app/utils/` for helper functions and other utilities.
107
107
 
108
108
  :link-example{to="/docs/4.x/examples/features/auto-imports"}
109
109
 
110
110
  ::warning
111
111
  **Auto-imported `ref` and `computed` won't be unwrapped in a component `<template>`.** :br
112
- This is due to how Vue works with refs that aren't top-level to the template. You can read more about it [in the Vue documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals.html#caveat-when-unwrapping-in-templates).
112
+ This is due to how Vue works with refs that aren't top-level to the template. You can read more about it [in the Vue documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals#caveat-when-unwrapping-in-templates).
113
113
  ::
114
114
 
115
115
  ### Explicit Imports
@@ -167,7 +167,7 @@ With this configuration:
167
167
 
168
168
  Nuxt also automatically imports components from your `~/components` directory, although this is configured separately from auto-importing composables and utility functions.
169
169
 
170
- :read-more{to="/docs/4.x/guide/directory-structure/app/components"}
170
+ :read-more{to="/docs/4.x/directory-structure/app/components"}
171
171
 
172
172
  To disable auto-importing components from your own `~/components` directory, you can set `components.dirs` to an empty array (though note that this will not affect components added by modules).
173
173
 
@@ -16,7 +16,7 @@ It is shipped with many features:
16
16
 
17
17
  ## API Layer
18
18
 
19
- Server [API endpoints](/docs/4.x/guide/directory-structure/server#server-routes) and [Middleware](/docs/4.x/guide/directory-structure/server#server-middleware) are added by Nitro that internally uses [h3](https://github.com/h3js/h3).
19
+ Server [API endpoints](/docs/4.x/directory-structure/server#server-routes) and [Middleware](/docs/4.x/directory-structure/server#server-middleware) are added by Nitro that internally uses [h3](https://github.com/h3js/h3).
20
20
 
21
21
  Key features include:
22
22
 
@@ -26,7 +26,7 @@ Key features include:
26
26
 
27
27
  Check out [the h3 docs](https://github.com/h3js/h3) for more information.
28
28
 
29
- ::read-more{to="/docs/4.x/guide/directory-structure/server#server-routes"}
29
+ ::read-more{to="/docs/4.x/directory-structure/server#server-routes"}
30
30
  Learn more about the API layer in the `server/` directory.
31
31
  ::
32
32
 
@@ -53,7 +53,7 @@ Nitro produces a standalone server dist that is independent of `node_modules`.
53
53
 
54
54
  The server in Nuxt 2 is not standalone and requires part of Nuxt core to be involved by running `nuxt start` (with the [`nuxt-start`](https://www.npmjs.com/package/nuxt-start) or [`nuxt`](https://www.npmjs.com/package/nuxt) distributions) or custom programmatic usage, which is fragile and prone to breakage and not suitable for serverless and service worker environments.
55
55
 
56
- Nuxt generates this dist when running `nuxt build` into a [`.output`](/docs/4.x/guide/directory-structure/output) directory.
56
+ Nuxt generates this dist when running `nuxt build` into a [`.output`](/docs/4.x/directory-structure/output) directory.
57
57
 
58
58
  The output contains runtime code to run your Nuxt server in any environment (including experimental browser service workers!) and serve your static files, making it a true hybrid framework for the JAMstack. In addition, Nuxt implements a native storage layer, supporting multi-source drivers and local assets.
59
59
 
@@ -17,7 +17,7 @@ Explore Nuxt Modules
17
17
 
18
18
  ## Add Nuxt Modules
19
19
 
20
- Once you have installed the modules you can add them to your [`nuxt.config.ts`](/docs/4.x/guide/directory-structure/nuxt-config) file under the `modules` property. Module developers usually provide additional steps and details for usage.
20
+ Once you have installed the modules you can add them to your [`nuxt.config.ts`](/docs/4.x/directory-structure/nuxt-config) file under the `modules` property. Module developers usually provide additional steps and details for usage.
21
21
 
22
22
  ```ts twoslash [nuxt.config.ts]
23
23
  export default defineNuxtConfig({
@@ -45,4 +45,4 @@ Nuxt modules are now build-time-only, and the `buildModules` property used in Nu
45
45
 
46
46
  Everyone has the opportunity to develop modules and we cannot wait to see what you will build.
47
47
 
48
- :read-more{to="/docs/4.x/guide/going-further/modules" title="Module Author Guide"}
48
+ :read-more{to="/docs/4.x/guide/modules" title="Module Author Guide"}
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  title: 'ES Modules'
3
3
  description: "Nuxt uses native ES modules."
4
+ navigation: false
4
5
  ---
5
6
 
6
7
  This guide helps explain what ES Modules are and how to make a Nuxt app (or upstream library) compatible with ESM.
@@ -31,7 +32,7 @@ export { a }
31
32
  ```
32
33
 
33
34
  Before ECMAScript Modules (ESM) became a standard (it took more than 10 years!), tooling like
34
- [webpack](https://webpack.js.org/guides/ecma-script-modules) and even languages like TypeScript started supporting so-called **ESM syntax**.
35
+ [webpack](https://webpack.js.org/guides/ecma-script-modules/) and even languages like TypeScript started supporting so-called **ESM syntax**.
35
36
  However, there are some key differences with actual spec; here's [a helpful explainer](https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/).
36
37
 
37
38
  ### What is 'Native' ESM?
@@ -161,7 +162,7 @@ const pkg = require('cjs-pkg')
161
162
  console.log(pkg) // { test: 123 }
162
163
  ```
163
164
 
164
- [Node.js in native ESM mode](https://nodejs.org/api/esm.html#interoperability-with-commonjs), [typescript with `esModuleInterop` enabled](https://www.typescriptlang.org/tsconfig#esModuleInterop) and bundlers such as webpack, provide a compatibility mechanism so that we can default import such library.
165
+ [Node.js in native ESM mode](https://nodejs.org/api/esm.html#interoperability-with-commonjs), [typescript with `esModuleInterop` enabled](https://www.typescriptlang.org/tsconfig/#esModuleInterop) and bundlers such as webpack, provide a compatibility mechanism so that we can default import such library.
165
166
  This mechanism is often referred to as "interop require default":
166
167
 
167
168
  ```js
@@ -47,56 +47,37 @@ export default defineNuxtConfig({
47
47
 
48
48
  ## Auto-generated Types
49
49
 
50
- When you run `nuxt dev` or `nuxt build`, Nuxt generates the following files for IDE type support (and type checking):
50
+ Nuxt projects rely on auto-generated types to work properly. These types are stored in the [`.nuxt`](/docs/4.x/directory-structure/nuxt) directory and are generated when you run the dev server or build your application. You can also generate these files manually by running `nuxt prepare`.
51
51
 
52
- ### `.nuxt/nuxt.d.ts`
52
+ The generated `tsconfig.json` files inside the [`.nuxt`](/docs/4.x/directory-structure/nuxt) directory include **recommended basic TypeScript configuration** for your project, references to [auto-imports](/docs/4.x/guide/concepts/auto-imports), [API route types](/docs/4.x/guide/concepts/server-engine#typed-api-routes), path aliases like `#imports`, `~/file`, or `#build/file`, and more.
53
53
 
54
- This file contains the types of any modules you are using, as well as the key types that Nuxt requires. Your IDE should recognize these types automatically.
55
-
56
- Some of the references in the file are to files that are only generated within your `buildDir` (`.nuxt`) and therefore for full typings, you will need to run `nuxt dev` or `nuxt build`.
57
-
58
- ### `.nuxt/tsconfig.app.json`
59
-
60
- This file contains the recommended basic TypeScript configuration for your project, including resolved aliases injected by Nuxt or modules you are using, so you can get full type support and path auto-complete for aliases like `~/file` or `#build/file`.
61
-
62
- ::note
63
- Consider using the `imports` section of [nuxt.config](/docs/4.x/api/nuxt-config#imports) to include directories beyond the default ones. This can be useful for auto-importing types which you're using across your app.
54
+ ::warning
55
+ Nuxt relies on this configuration, and [Nuxt modules](/docs/4.x/guide/modules) can extend it as well. For this reason, it is not recommended to modify your `tsconfig.json` file directly, as doing so could overwrite important settings. Instead, extend it via `nuxt.config.ts`. [Learn more about extending the configuration here](/docs/4.x/directory-structure/tsconfig).
64
56
  ::
65
57
 
66
- [Read more about how to extend this configuration](/docs/4.x/guide/directory-structure/tsconfig).
67
-
68
58
  ::tip{icon="i-lucide-video" to="https://youtu.be/umLI7SlPygY" target="_blank"}
69
59
  Watch a video from Daniel Roe explaining built-in Nuxt aliases.
70
60
  ::
71
61
 
72
- ::note
73
- Nitro also [auto-generates types](/docs/4.x/guide/concepts/server-engine#typed-api-routes) for API routes. Plus, Nuxt also generates types for globally available components and [auto-imports from your composables](/docs/4.x/guide/directory-structure/app/composables), plus other core functionality.
74
- ::
75
-
76
- ::note
77
- For backward compatibility, Nuxt still generates `./.nuxt/tsconfig.json`. However, we recommend using [TypeScript project references](/docs/4.x/guide/directory-structure/tsconfig) with the new configuration files (`.nuxt/tsconfig.app.json`, `.nuxt/tsconfig.server.json`, etc.) for better type safety and performance.
78
-
79
- If you do extend from `./.nuxt/tsconfig.json`, keep in mind that all options will be overwritten by those defined in your `tsconfig.json`. Overwriting options such as `"compilerOptions.paths"` with your own configuration will lead TypeScript to not factor in the module resolutions, which can cause module resolutions such as `#imports` to not be recognized.
80
-
81
- In case you need to extend options further, you can use the [`alias` property](/docs/4.x/api/nuxt-config#alias) within your `nuxt.config`. Nuxt will pick them up and extend the generated TypeScript configurations accordingly.
82
- ::
83
-
84
62
  ## Project References
85
63
 
86
64
  Nuxt uses [TypeScript project references](https://www.typescriptlang.org/docs/handbook/project-references.html) to improve type-checking performance and provide better IDE support. This feature allows TypeScript to break up your codebase into smaller, more manageable pieces.
87
65
 
88
66
  ### How Nuxt Uses Project References
89
67
 
90
- When you run `nuxt dev` or `nuxt build`, Nuxt will generate multiple `tsconfig.json` files for different parts of your application.
68
+ When you run `nuxt dev`, `nuxt build` or `nuxt prepare`, Nuxt will generate multiple `tsconfig.json` files for different parts of your application.
91
69
 
92
- - **`.nuxt/tsconfig.app.json`** - Configuration for your application code
93
- - **`.nuxt/tsconfig.node.json`** - Configuration for your `nuxt.config` and modules
70
+ - **`.nuxt/tsconfig.app.json`** - Configuration for your application code within the `app/` directory
71
+ - **`.nuxt/tsconfig.node.json`** - Configuration for your `nuxt.config.ts` and files outside the other contexts
94
72
  - **`.nuxt/tsconfig.server.json`** - Configuration for server-side code (when applicable)
95
73
  - **`.nuxt/tsconfig.shared.json`** - For code shared between app and server contexts (like types and non-environment specific utilities)
96
- - **`.nuxt/tsconfig.json`** - Legacy configuration for backward compatibility
97
74
 
98
75
  Each of these files is configured to reference the appropriate dependencies and provide optimal type-checking for their specific context.
99
76
 
77
+ ::note
78
+ For backward compatibility, Nuxt still generates `.nuxt/tsconfig.json`. However, we recommend using [TypeScript project references](/docs/4.x/directory-structure/tsconfig) with the new configuration files (`.nuxt/tsconfig.app.json`, `.nuxt/tsconfig.server.json`, etc.) for better type safety and performance. This legacy file will be removed in a future version of Nuxt.
79
+ ::
80
+
100
81
  ### Benefits of Project References
101
82
 
102
83
  - **Faster builds**: TypeScript can skip rebuilding unchanged projects
@@ -104,13 +85,9 @@ Each of these files is configured to reference the appropriate dependencies and
104
85
  - **Isolated compilation**: Errors in one part of your application don't prevent compilation of other parts
105
86
  - **Clearer dependency management**: Each project explicitly declares its dependencies
106
87
 
107
- ::note
108
- The project reference setup is handled automatically by Nuxt. You typically don't need to modify these configurations manually, but understanding how they work can help you troubleshoot type-checking issues.
109
- ::
110
-
111
88
  ### Augmenting Types with Project References
112
89
 
113
- Since the project is divided into **multiple type contexts**, it's important to **augment types within the correct context** to ensure they are properly recognized.
90
+ Since the project is divided into **multiple type contexts**, it's important to **augment types within the correct context** to ensure they're properly recognized. TypeScript will not recognize augmentations placed outside these directories unless they are explicitly included in the appropriate context.
114
91
 
115
92
  For example, if you want to augment types for the `app` context, the augmentation file should be placed in the `app/` directory.
116
93
 
@@ -118,15 +95,15 @@ Similarly:
118
95
  - For the `server` context, place the augmentation file in the `server/` directory.
119
96
  - For types that are **shared between the app and server**, place the file in the `shared/` directory.
120
97
 
121
- ::warning
122
- Augmenting types outside of these directories will not be recognized by TypeScript.
98
+ ::read-more{to="/docs/4.x/guide/modules/recipes-advanced#extend-typescript-config"}
99
+ Read more about augmenting specific type contexts from **files outside those contexts** in the Module Author Guide.
123
100
  ::
124
101
 
125
102
  ## Strict Checks
126
103
 
127
104
  TypeScript comes with certain checks to give you more safety and analysis of your program.
128
105
 
129
- [Strict checks](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) are enabled by default in Nuxt to give you greater type safety.
106
+ [Strict checks](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html#getting-stricter-checks) are enabled by default in Nuxt when the [`typescript.typeCheck`](/docs/4.x/guide/concepts/typescript#type-checking) option is enabled to give you greater type safety.
130
107
 
131
108
  If you are currently converting your codebase to TypeScript, you may want to temporarily disable strict checks by setting `strict` to `false` in your `nuxt.config`:
132
109
 
@@ -8,7 +8,7 @@ description: "Nuxt supports ESLint out of the box"
8
8
  The recommended approach for Nuxt is to enable ESLint support using the [`@nuxt/eslint`](https://eslint.nuxt.com/packages/module) module, that will setup project-aware ESLint configuration for you.
9
9
 
10
10
  :::callout{icon="i-lucide-lightbulb"}
11
- The module is designed for the [new ESLint flat config format](https://eslint.org/docs/latest/use/configure/configuration-files-new) with is the [default format since ESLint v9](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/). If you are using the legacy `.eslintrc` config, you will need to [configure manually with `@nuxt/eslint-config`](https://eslint.nuxt.com/packages/config#legacy-config-format). We highly recommend you to migrate over the flat config to be future-proof.
11
+ The module is designed for the [new ESLint flat config format](https://eslint.org/docs/latest/use/configure/configuration-files) which is the [default format since ESLint v9](https://eslint.org/blog/2024/04/eslint-v9.0.0-released/). If you are using the legacy `.eslintrc` config, you will need to [configure manually with `@nuxt/eslint-config`](https://eslint.nuxt.com/packages/config#customizing-the-config). We highly recommend you to migrate over the flat config to be future-proof.
12
12
  :::
13
13
 
14
14
  ## Quick Setup
@@ -184,5 +184,5 @@ onMounted(() => {
184
184
  4. **Avoid side effects in setup**: Move browser-dependent code to `onMounted`
185
185
 
186
186
  ::tip
187
- You can read the [Vue documentation on SSR hydration mismatch](https://vuejs.org/guide/scaling-up/ssr.html#hydration-mismatch) for a better understanding of hydration.
187
+ You can read the [Vue documentation on SSR hydration mismatch](https://vuejs.org/guide/scaling-up/ssr#hydration-mismatch) for a better understanding of hydration.
188
188
  ::
@@ -90,7 +90,7 @@ const show = ref(false)
90
90
 
91
91
  By using the Lazy prefix you can delay loading the component code until the right moment, which can be helpful for optimizing your JavaScript bundle size.
92
92
 
93
- :read-more{title="Lazy loading components" to="/docs/4.x/guide/directory-structure/app/components#dynamic-imports"}
93
+ :read-more{title="Lazy loading components" to="/docs/4.x/directory-structure/app/components#dynamic-imports"}
94
94
 
95
95
  ### Lazy Hydration
96
96
 
@@ -106,7 +106,7 @@ It is not always necessary to hydrate (or make interactive) all the components o
106
106
 
107
107
  To optimize your app, you may want to delay the hydration of some components until they're visible, or until the browser is done with more important tasks.
108
108
 
109
- :read-more{title="Lazy hydration" to="/docs/4.x/guide/directory-structure/app/components#delayed-or-lazy-hydration"}
109
+ :read-more{title="Lazy hydration" to="/docs/4.x/directory-structure/app/components#delayed-or-lazy-hydration"}
110
110
 
111
111
  ### Fetching data
112
112
 
@@ -0,0 +1,3 @@
1
+ title: 'Working with AI'
2
+ titleTemplate: 'Working with AI: %s'
3
+ icon: i-lucide-bot