@nuxt/docs 0.0.0 → 3.17.0

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 (224) hide show
  1. package/.navigation.yml +2 -0
  2. package/1.getting-started/.navigation.yml +3 -0
  3. package/1.getting-started/01.introduction.md +81 -0
  4. package/1.getting-started/02.installation.md +109 -0
  5. package/1.getting-started/03.configuration.md +226 -0
  6. package/1.getting-started/04.views.md +163 -0
  7. package/1.getting-started/05.assets.md +48 -0
  8. package/1.getting-started/06.styling.md +565 -0
  9. package/1.getting-started/07.routing.md +149 -0
  10. package/1.getting-started/08.seo-meta.md +360 -0
  11. package/1.getting-started/09.transitions.md +473 -0
  12. package/1.getting-started/10.data-fetching.md +795 -0
  13. package/1.getting-started/11.state-management.md +223 -0
  14. package/1.getting-started/12.error-handling.md +233 -0
  15. package/1.getting-started/13.server.md +94 -0
  16. package/1.getting-started/14.layers.md +92 -0
  17. package/1.getting-started/15.prerendering.md +194 -0
  18. package/1.getting-started/16.deployment.md +130 -0
  19. package/1.getting-started/17.testing.md +728 -0
  20. package/1.getting-started/18.upgrade.md +997 -0
  21. package/2.guide/.navigation.yml +2 -0
  22. package/2.guide/0.index.md +22 -0
  23. package/2.guide/1.concepts/.navigation.yml +3 -0
  24. package/2.guide/1.concepts/1.auto-imports.md +205 -0
  25. package/2.guide/1.concepts/10.nuxt-lifecycle.md +141 -0
  26. package/2.guide/1.concepts/2.vuejs-development.md +103 -0
  27. package/2.guide/1.concepts/3.rendering.md +255 -0
  28. package/2.guide/1.concepts/4.server-engine.md +62 -0
  29. package/2.guide/1.concepts/5.modules.md +48 -0
  30. package/2.guide/1.concepts/7.esm.md +299 -0
  31. package/2.guide/1.concepts/8.typescript.md +97 -0
  32. package/2.guide/1.concepts/9.code-style.md +22 -0
  33. package/2.guide/2.directory-structure/.navigation.yml +3 -0
  34. package/2.guide/2.directory-structure/0.nuxt.md +20 -0
  35. package/2.guide/2.directory-structure/0.output.md +18 -0
  36. package/2.guide/2.directory-structure/1.assets.md +16 -0
  37. package/2.guide/2.directory-structure/1.components.md +608 -0
  38. package/2.guide/2.directory-structure/1.composables.md +121 -0
  39. package/2.guide/2.directory-structure/1.content.md +64 -0
  40. package/2.guide/2.directory-structure/1.layouts.md +180 -0
  41. package/2.guide/2.directory-structure/1.middleware.md +209 -0
  42. package/2.guide/2.directory-structure/1.modules.md +66 -0
  43. package/2.guide/2.directory-structure/1.node_modules.md +12 -0
  44. package/2.guide/2.directory-structure/1.pages.md +440 -0
  45. package/2.guide/2.directory-structure/1.plugins.md +299 -0
  46. package/2.guide/2.directory-structure/1.public.md +27 -0
  47. package/2.guide/2.directory-structure/1.server.md +546 -0
  48. package/2.guide/2.directory-structure/1.shared.md +104 -0
  49. package/2.guide/2.directory-structure/1.utils.md +49 -0
  50. package/2.guide/2.directory-structure/2.env.md +75 -0
  51. package/2.guide/2.directory-structure/2.gitignore.md +37 -0
  52. package/2.guide/2.directory-structure/2.nuxtignore.md +36 -0
  53. package/2.guide/2.directory-structure/2.nuxtrc.md +50 -0
  54. package/2.guide/2.directory-structure/3.app-config.md +177 -0
  55. package/2.guide/2.directory-structure/3.app.md +72 -0
  56. package/2.guide/2.directory-structure/3.error.md +55 -0
  57. package/2.guide/2.directory-structure/3.nuxt-config.md +34 -0
  58. package/2.guide/2.directory-structure/3.package.md +32 -0
  59. package/2.guide/2.directory-structure/3.tsconfig.md +24 -0
  60. package/2.guide/3.going-further/.navigation.yml +3 -0
  61. package/2.guide/3.going-further/1.experimental-features.md +689 -0
  62. package/2.guide/3.going-further/1.features.md +103 -0
  63. package/2.guide/3.going-further/1.internals.md +81 -0
  64. package/2.guide/3.going-further/10.runtime-config.md +174 -0
  65. package/2.guide/3.going-further/11.nightly-release-channel.md +68 -0
  66. package/2.guide/3.going-further/2.hooks.md +98 -0
  67. package/2.guide/3.going-further/3.modules.md +811 -0
  68. package/2.guide/3.going-further/4.kit.md +51 -0
  69. package/2.guide/3.going-further/6.nuxt-app.md +64 -0
  70. package/2.guide/3.going-further/7.layers.md +227 -0
  71. package/2.guide/3.going-further/9.debugging.md +115 -0
  72. package/2.guide/3.going-further/index.md +4 -0
  73. package/2.guide/4.recipes/.navigation.yml +3 -0
  74. package/2.guide/4.recipes/1.custom-routing.md +181 -0
  75. package/2.guide/4.recipes/2.vite-plugin.md +65 -0
  76. package/2.guide/4.recipes/3.custom-usefetch.md +125 -0
  77. package/2.guide/4.recipes/4.sessions-and-authentication.md +203 -0
  78. package/3.api/.navigation.yml +3 -0
  79. package/3.api/1.components/.navigation.yml +3 -0
  80. package/3.api/1.components/1.client-only.md +76 -0
  81. package/3.api/1.components/1.dev-only.md +51 -0
  82. package/3.api/1.components/1.nuxt-client-fallback.md +80 -0
  83. package/3.api/1.components/10.nuxt-picture.md +27 -0
  84. package/3.api/1.components/11.teleports.md +40 -0
  85. package/3.api/1.components/12.nuxt-route-announcer.md +56 -0
  86. package/3.api/1.components/13.nuxt-time.md +173 -0
  87. package/3.api/1.components/2.nuxt-page.md +154 -0
  88. package/3.api/1.components/3.nuxt-layout.md +156 -0
  89. package/3.api/1.components/4.nuxt-link.md +322 -0
  90. package/3.api/1.components/5.nuxt-loading-indicator.md +50 -0
  91. package/3.api/1.components/6.nuxt-error-boundary.md +65 -0
  92. package/3.api/1.components/7.nuxt-welcome.md +25 -0
  93. package/3.api/1.components/8.nuxt-island.md +70 -0
  94. package/3.api/1.components/9.nuxt-img.md +43 -0
  95. package/3.api/2.composables/.navigation.yml +3 -0
  96. package/3.api/2.composables/on-prehydrate.md +60 -0
  97. package/3.api/2.composables/use-app-config.md +19 -0
  98. package/3.api/2.composables/use-async-data.md +212 -0
  99. package/3.api/2.composables/use-cookie.md +233 -0
  100. package/3.api/2.composables/use-error.md +32 -0
  101. package/3.api/2.composables/use-fetch.md +217 -0
  102. package/3.api/2.composables/use-head-safe.md +55 -0
  103. package/3.api/2.composables/use-head.md +69 -0
  104. package/3.api/2.composables/use-hydration.md +68 -0
  105. package/3.api/2.composables/use-lazy-async-data.md +47 -0
  106. package/3.api/2.composables/use-lazy-fetch.md +55 -0
  107. package/3.api/2.composables/use-loading-indicator.md +77 -0
  108. package/3.api/2.composables/use-nuxt-app.md +294 -0
  109. package/3.api/2.composables/use-nuxt-data.md +112 -0
  110. package/3.api/2.composables/use-preview-mode.md +118 -0
  111. package/3.api/2.composables/use-request-event.md +23 -0
  112. package/3.api/2.composables/use-request-fetch.md +52 -0
  113. package/3.api/2.composables/use-request-header.md +34 -0
  114. package/3.api/2.composables/use-request-headers.md +37 -0
  115. package/3.api/2.composables/use-request-url.md +41 -0
  116. package/3.api/2.composables/use-response-header.md +48 -0
  117. package/3.api/2.composables/use-route-announcer.md +60 -0
  118. package/3.api/2.composables/use-route.md +52 -0
  119. package/3.api/2.composables/use-router.md +92 -0
  120. package/3.api/2.composables/use-runtime-config.md +142 -0
  121. package/3.api/2.composables/use-runtime-hook.md +43 -0
  122. package/3.api/2.composables/use-seo-meta.md +80 -0
  123. package/3.api/2.composables/use-server-seo-meta.md +27 -0
  124. package/3.api/2.composables/use-state.md +48 -0
  125. package/3.api/3.utils/$fetch.md +98 -0
  126. package/3.api/3.utils/.navigation.yml +3 -0
  127. package/3.api/3.utils/abort-navigation.md +73 -0
  128. package/3.api/3.utils/add-route-middleware.md +88 -0
  129. package/3.api/3.utils/call-once.md +92 -0
  130. package/3.api/3.utils/clear-error.md +29 -0
  131. package/3.api/3.utils/clear-nuxt-data.md +23 -0
  132. package/3.api/3.utils/clear-nuxt-state.md +23 -0
  133. package/3.api/3.utils/create-error.md +55 -0
  134. package/3.api/3.utils/define-nuxt-component.md +53 -0
  135. package/3.api/3.utils/define-nuxt-route-middleware.md +67 -0
  136. package/3.api/3.utils/define-page-meta.md +234 -0
  137. package/3.api/3.utils/define-route-rules.md +52 -0
  138. package/3.api/3.utils/navigate-to.md +230 -0
  139. package/3.api/3.utils/on-before-route-leave.md +11 -0
  140. package/3.api/3.utils/on-before-route-update.md +11 -0
  141. package/3.api/3.utils/on-nuxt-ready.md +25 -0
  142. package/3.api/3.utils/prefetch-components.md +28 -0
  143. package/3.api/3.utils/preload-components.md +23 -0
  144. package/3.api/3.utils/preload-route-components.md +41 -0
  145. package/3.api/3.utils/prerender-routes.md +46 -0
  146. package/3.api/3.utils/refresh-cookie.md +46 -0
  147. package/3.api/3.utils/refresh-nuxt-data.md +91 -0
  148. package/3.api/3.utils/reload-nuxt-app.md +74 -0
  149. package/3.api/3.utils/set-page-layout.md +24 -0
  150. package/3.api/3.utils/set-response-status.md +36 -0
  151. package/3.api/3.utils/show-error.md +31 -0
  152. package/3.api/3.utils/update-app-config.md +27 -0
  153. package/3.api/4.commands/.navigation.yml +3 -0
  154. package/3.api/4.commands/add.md +112 -0
  155. package/3.api/4.commands/analyze.md +41 -0
  156. package/3.api/4.commands/build-module.md +42 -0
  157. package/3.api/4.commands/build.md +46 -0
  158. package/3.api/4.commands/cleanup.md +38 -0
  159. package/3.api/4.commands/dev.md +59 -0
  160. package/3.api/4.commands/devtools.md +38 -0
  161. package/3.api/4.commands/generate.md +41 -0
  162. package/3.api/4.commands/info.md +33 -0
  163. package/3.api/4.commands/init.md +46 -0
  164. package/3.api/4.commands/module.md +84 -0
  165. package/3.api/4.commands/prepare.md +36 -0
  166. package/3.api/4.commands/preview.md +43 -0
  167. package/3.api/4.commands/typecheck.md +42 -0
  168. package/3.api/4.commands/upgrade.md +37 -0
  169. package/3.api/5.kit/.navigation.yml +3 -0
  170. package/3.api/5.kit/1.modules.md +172 -0
  171. package/3.api/5.kit/10.runtime-config.md +27 -0
  172. package/3.api/5.kit/10.templates.md +283 -0
  173. package/3.api/5.kit/11.nitro.md +409 -0
  174. package/3.api/5.kit/12.resolving.md +268 -0
  175. package/3.api/5.kit/13.logging.md +65 -0
  176. package/3.api/5.kit/14.builder.md +491 -0
  177. package/3.api/5.kit/15.examples.md +41 -0
  178. package/3.api/5.kit/2.programmatic.md +125 -0
  179. package/3.api/5.kit/3.compatibility.md +230 -0
  180. package/3.api/5.kit/4.autoimports.md +144 -0
  181. package/3.api/5.kit/5.components.md +127 -0
  182. package/3.api/5.kit/6.context.md +130 -0
  183. package/3.api/5.kit/7.pages.md +295 -0
  184. package/3.api/5.kit/8.layout.md +80 -0
  185. package/3.api/5.kit/9.plugins.md +263 -0
  186. package/3.api/6.advanced/.navigation.yml +1 -0
  187. package/3.api/6.advanced/1.hooks.md +105 -0
  188. package/3.api/6.advanced/2.import-meta.md +60 -0
  189. package/3.api/6.nuxt-config.md +12 -0
  190. package/3.api/index.md +31 -0
  191. package/5.community/.navigation.yml +3 -0
  192. package/5.community/2.getting-help.md +48 -0
  193. package/5.community/3.reporting-bugs.md +50 -0
  194. package/5.community/4.contribution.md +205 -0
  195. package/5.community/5.framework-contribution.md +142 -0
  196. package/5.community/6.roadmap.md +79 -0
  197. package/5.community/7.changelog.md +92 -0
  198. package/6.bridge/.navigation.yml +3 -0
  199. package/6.bridge/1.overview.md +137 -0
  200. package/6.bridge/10.configuration.md +96 -0
  201. package/6.bridge/2.typescript.md +46 -0
  202. package/6.bridge/3.bridge-composition-api.md +132 -0
  203. package/6.bridge/4.plugins-and-middleware.md +65 -0
  204. package/6.bridge/5.nuxt3-compatible-api.md +204 -0
  205. package/6.bridge/6.meta.md +117 -0
  206. package/6.bridge/7.runtime-config.md +38 -0
  207. package/6.bridge/8.nitro.md +102 -0
  208. package/6.bridge/9.vite.md +37 -0
  209. package/7.migration/.navigation.yml +3 -0
  210. package/7.migration/1.overview.md +24 -0
  211. package/7.migration/10.bundling.md +28 -0
  212. package/7.migration/11.server.md +17 -0
  213. package/7.migration/2.configuration.md +240 -0
  214. package/7.migration/20.module-authors.md +94 -0
  215. package/7.migration/3.auto-imports.md +18 -0
  216. package/7.migration/4.meta.md +127 -0
  217. package/7.migration/5.plugins-and-middleware.md +80 -0
  218. package/7.migration/6.pages-and-layouts.md +233 -0
  219. package/7.migration/7.component-options.md +156 -0
  220. package/7.migration/8.runtime-config.md +58 -0
  221. package/LICENSE +21 -0
  222. package/README.md +11 -0
  223. package/package.json +16 -4
  224. package/dist/.gitkeep +0 -0
@@ -0,0 +1,105 @@
1
+ ---
2
+ title: 'Lifecycle Hooks'
3
+ description: Nuxt provides a powerful hooking system to expand almost every aspect using hooks.
4
+ ---
5
+
6
+ :read-more{to="/docs/guide/going-further/hooks"}
7
+
8
+ ## App Hooks (runtime)
9
+
10
+ Check the [app source code](https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/nuxt.ts#L37) for all available hooks.
11
+
12
+ Hook | Arguments | Environment | Description
13
+ -----------------------|---------------------|-----------------|-------------
14
+ `app:created` | `vueApp` | Server & Client | Called when initial `vueApp` instance is created.
15
+ `app:error` | `err` | Server & Client | Called when a fatal error occurs.
16
+ `app:error:cleared` | `{ redirect? }` | Server & Client | Called when a fatal error occurs.
17
+ `vue:setup` | - | Server & Client | Called when the setup of Nuxt root is initialized. This callback must be synchronous.
18
+ `vue:error` | `err, target, info` | Server & Client | Called when a vue error propagates to the root component. [Learn More](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured).
19
+ `app:rendered` | `renderContext` | Server | Called when SSR rendering is done.
20
+ `app:redirected` | - | Server | Called before SSR redirection.
21
+ `app:beforeMount` | `vueApp` | Client | Called before mounting the app, called only on client side.
22
+ `app:mounted` | `vueApp` | Client | Called when Vue app is initialized and mounted in browser.
23
+ `app:suspense:resolve` | `appComponent` | Client | On [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) resolved event.
24
+ `app:manifest:update` | `{ id, timestamp }` | Client | Called when there is a newer version of your app detected.
25
+ `app:data:refresh` | `keys?` | Client | Called when `refreshNuxtData` is called.
26
+ `link:prefetch` | `to` | Client | Called when a `<NuxtLink>` is observed to be prefetched.
27
+ `page:start` | `pageComponent?` | Client | Called on [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) inside of `NuxtPage` pending event.
28
+ `page:finish` | `pageComponent?` | Client | Called on [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) inside of `NuxtPage` resolved event.
29
+ `page:loading:start` | - | Client | Called when the `setup()` of the new page is running.
30
+ `page:loading:end` | - | Client | Called after `page:finish`
31
+ `page:transition:finish`| `pageComponent?` | Client | After page transition [onAfterLeave](https://vuejs.org/guide/built-ins/transition.html#javascript-hooks) event.
32
+ `dev:ssr-logs` | `logs` | Client | Called with an array of server-side logs that have been passed to the client (if `features.devLogs` is enabled).
33
+ `page:view-transition:start` | `transition` | Client | Called after `document.startViewTransition` is called when [experimental viewTransition support is enabled](/docs/getting-started/transitions#view-transitions-api-experimental).
34
+
35
+ ## Nuxt Hooks (build time)
36
+
37
+ Check the [schema source code](https://github.com/nuxt/nuxt/blob/main/packages/schema/src/types/hooks.ts#L83) for all available hooks.
38
+
39
+ Hook | Arguments | Description
40
+ -------------------------|----------------------------|-------------
41
+ `kit:compatibility` | `compatibility, issues` | Allows extending compatibility checks.
42
+ `ready` | `nuxt` | Called after Nuxt initialization, when the Nuxt instance is ready to work.
43
+ `close` | `nuxt` | Called when Nuxt instance is gracefully closing.
44
+ `restart` | `{ hard?: boolean }` | To be called to restart the current Nuxt instance.
45
+ `modules:before` | - | Called during Nuxt initialization, before installing user modules.
46
+ `modules:done` | - | Called during Nuxt initialization, after installing user modules.
47
+ `app:resolve` | `app` | Called after resolving the `app` instance.
48
+ `app:templates` | `app` | Called during `NuxtApp` generation, to allow customizing, modifying or adding new files to the build directory (either virtually or to written to `.nuxt`).
49
+ `app:templatesGenerated` | `app` | Called after templates are compiled into the [virtual file system](/docs/guide/directory-structure/nuxt#virtual-file-system) (vfs).
50
+ `build:before` | - | Called before Nuxt bundle builder.
51
+ `build:done` | - | Called after Nuxt bundle builder is complete.
52
+ `build:manifest` | `manifest` | Called during the manifest build by Vite and webpack. This allows customizing the manifest that Nitro will use to render `<script>` and `<link>` tags in the final HTML.
53
+ `builder:generateApp` | `options` | Called before generating the app.
54
+ `builder:watch` | `event, path` | Called at build time in development when the watcher spots a change to a file or directory in the project.
55
+ `pages:extend` | `pages` | Called after page routes are scanned from the file system.
56
+ `pages:resolved` | `pages` | Called after page routes have been augmented with scanned metadata.
57
+ `pages:routerOptions` | `{ files: Array<{ path: string, optional?: boolean }> }` | Called when resolving `router.options` files. Later items in the array override earlier ones.
58
+ `server:devHandler` | `handler` | Called when the dev middleware is being registered on the Nitro dev server.
59
+ `imports:sources` | `presets` | Called at setup allowing modules to extend sources.
60
+ `imports:extend` | `imports` | Called at setup allowing modules to extend imports.
61
+ `imports:context` | `context` | Called when the [unimport](https://github.com/unjs/unimport) context is created.
62
+ `imports:dirs` | `dirs` | Allows extending import directories.
63
+ `components:dirs` | `dirs` | Called within `app:resolve` allowing to extend the directories that are scanned for auto-importable components.
64
+ `components:extend` | `components` | Allows extending new components.
65
+ `nitro:config` | `nitroConfig` | Called before initializing Nitro, allowing customization of Nitro's configuration.
66
+ `nitro:init` | `nitro` | Called after Nitro is initialized, which allows registering Nitro hooks and interacting directly with Nitro.
67
+ `nitro:build:before` | `nitro` | Called before building the Nitro instance.
68
+ `nitro:build:public-assets` | `nitro` | Called after copying public assets. Allows modifying public assets before Nitro server is built.
69
+ `prerender:routes` | `ctx` | Allows extending the routes to be pre-rendered.
70
+ `build:error` | `error` | Called when an error occurs at build time.
71
+ `prepare:types` | `options` | Called before Nuxi writes `.nuxt/tsconfig.json` and `.nuxt/nuxt.d.ts`, allowing addition of custom references and declarations in `nuxt.d.ts`, or directly modifying the options in `tsconfig.json`
72
+ `listen` | `listenerServer, listener` | Called when the dev server is loading.
73
+ `schema:extend` | `schemas` | Allows extending default schemas.
74
+ `schema:resolved` | `schema` | Allows extending resolved schema.
75
+ `schema:beforeWrite` | `schema` | Called before writing the given schema.
76
+ `schema:written` | - | Called after the schema is written.
77
+ `vite:extend` | `viteBuildContext` | Allows to extend Vite default context.
78
+ `vite:extendConfig` | `viteInlineConfig, env` | Allows to extend Vite default config.
79
+ `vite:configResolved` | `viteInlineConfig, env` | Allows to read the resolved Vite config.
80
+ `vite:serverCreated` | `viteServer, env` | Called when the Vite server is created.
81
+ `vite:compiled` | - | Called after Vite server is compiled.
82
+ `webpack:config` | `webpackConfigs` | Called before configuring the webpack compiler.
83
+ `webpack:configResolved` | `webpackConfigs` | Allows to read the resolved webpack config.
84
+ `webpack:compile` | `options` | Called right before compilation.
85
+ `webpack:compiled` | `options` | Called after resources are loaded.
86
+ `webpack:change` | `shortPath` | Called on `change` on WebpackBar.
87
+ `webpack:error` | - | Called on `done` if has errors on WebpackBar.
88
+ `webpack:done` | - | Called on `allDone` on WebpackBar.
89
+ `webpack:progress` | `statesArray` | Called on `progress` on WebpackBar.
90
+
91
+ ## Nitro App Hooks (runtime, server-side)
92
+
93
+ See [Nitro](https://nitro.unjs.io/guide/plugins#available-hooks) for all available hooks.
94
+
95
+ Hook | Arguments | Description | Types
96
+ -----------------------|-----------------------|--------------------------------------|------------------
97
+ `dev:ssr-logs` | `{ path, logs }` | Server | Called at the end of a request cycle with an array of server-side logs.
98
+ `render:response` | `response, { event }` | Called before sending the response. | [response](https://github.com/nuxt/nuxt/blob/71ef8bd3ff207fd51c2ca18d5a8c7140476780c7/packages/nuxt/src/core/runtime/nitro/renderer.ts#L24), [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38)
99
+ `render:html` | `html, { event }` | Called before constructing the HTML. | [html](https://github.com/nuxt/nuxt/blob/71ef8bd3ff207fd51c2ca18d5a8c7140476780c7/packages/nuxt/src/core/runtime/nitro/renderer.ts#L15), [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38)
100
+ `render:island` | `islandResponse, { event, islandContext }` | Called before constructing the island HTML. | [islandResponse](https://github.com/nuxt/nuxt/blob/e50cabfed1984c341af0d0c056a325a8aec26980/packages/nuxt/src/core/runtime/nitro/renderer.ts#L28), [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38), [islandContext](https://github.com/nuxt/nuxt/blob/e50cabfed1984c341af0d0c056a325a8aec26980/packages/nuxt/src/core/runtime/nitro/renderer.ts#L38)
101
+ `close` | - | Called when Nitro is closed. | -
102
+ `error` | `error, { event? }` | Called when an error occurs. | [error](https://github.com/nitrojs/nitro/blob/d20ffcbd16fc4003b774445e1a01e698c2bb078a/src/types/runtime/nitro.ts#L48), [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38)
103
+ `request` | `event` | Called when a request is received. | [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38)
104
+ `beforeResponse` | `event, { body }` | Called before sending the response. | [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38), unknown
105
+ `afterResponse` | `event, { body }` | Called after sending the response. | [event](https://github.com/unjs/h3/blob/f6ceb5581043dc4d8b6eab91e9be4531e0c30f8e/src/types.ts#L38), unknown
@@ -0,0 +1,60 @@
1
+ ---
2
+ title: 'Import meta'
3
+ description: Understand where your code is running using `import.meta`.
4
+ ---
5
+
6
+ ## The `import.meta` object
7
+
8
+ With ES modules you can obtain some metadata from the code that imports or compiles your ES-module.
9
+ This is done through `import.meta`, which is an object that provides your code with this information.
10
+ Throughout the Nuxt documentation you may see snippets that use this already to figure out whether the
11
+ code is currently running on the client or server side.
12
+
13
+ ::read-more{to="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta"}
14
+ Read more about `import.meta`.
15
+ ::
16
+
17
+ ## Runtime (App) Properties
18
+
19
+ These values are statically injected and can be used for tree-shaking your runtime code.
20
+
21
+ Property | Type | Description
22
+ --- | --- | ---
23
+ `import.meta.client` | boolean | True when evaluated on the client side.
24
+ `import.meta.browser` | boolean | True when evaluated on the client side.
25
+ `import.meta.server` | boolean | True when evaluated on the server side.
26
+ `import.meta.nitro` | boolean | True when evaluated on the server side.
27
+ `import.meta.dev` | boolean | True when running the Nuxt dev server.
28
+ `import.meta.test` | boolean | True when running in a test context.
29
+ `import.meta.prerender` | boolean | True when rendering HTML on the server in the prerender stage of your build.
30
+
31
+ ## Builder Properties
32
+
33
+ These values are available both in modules and in your `nuxt.config`.
34
+
35
+ Property | Type | Description
36
+ --- | --- | ---
37
+ `import.meta.env` | object | Equals `process.env`
38
+ `import.meta.url` | string | Resolvable path for the current file.
39
+
40
+ ## Examples
41
+
42
+ ### Using `import.meta.url` to resolve files within modules
43
+
44
+ ```ts [modules/my-module/index.ts]
45
+ import { createResolver } from 'nuxt/kit'
46
+
47
+ // Resolve relative from the current file
48
+ const resolver = createResolver(import.meta.url)
49
+
50
+ export default defineNuxtModule({
51
+ meta: { name: 'myModule' },
52
+ setup() {
53
+ addComponent({
54
+ name: 'MyModuleComponent',
55
+ // Resolves to '/modules/my-module/components/MyModuleComponent.vue'
56
+ filePath: resolver.resolve('./components/MyModuleComponent.vue')
57
+ })
58
+ }
59
+ })
60
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ title: Nuxt Configuration
3
+ titleTemplate: '%s'
4
+ description: Discover all the options you can use in your nuxt.config.ts file.
5
+ navigation.icon: i-lucide-cog
6
+ ---
7
+
8
+ ::note{icon="i-simple-icons-github" to="https://github.com/nuxt/nuxt/tree/main/packages/schema/src/config" target="_blank"}
9
+ This file is auto-generated from Nuxt source code.
10
+ ::
11
+
12
+ <!-- GENERATED_CONFIG_DOCS -->
package/3.api/index.md ADDED
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: 'Nuxt API Reference'
3
+ titleTemplate: '%s'
4
+ description: 'Explore all Nuxt Internals: Components, Composables, Utils, Commands and more.'
5
+ navigation: false
6
+ surround: false
7
+ ---
8
+
9
+ ::card-group
10
+ ::card{icon="i-lucide-box" title="Components" to="/docs/api/components/client-only"}
11
+ Explore Nuxt built-in components for pages, layouts, head, and more.
12
+ ::
13
+ ::card{icon="i-lucide-arrow-left-right" title="Composables" to="/docs/api/composables/use-app-config"}
14
+ Discover Nuxt composable functions for data-fetching, head management and more.
15
+ ::
16
+ ::card{icon="i-lucide-square-function" title="Utils" to="/docs/api/utils/dollarfetch"}
17
+ Learn about Nuxt utility functions for navigation, error handling and more.
18
+ ::
19
+ ::card{icon="i-lucide-square-terminal" title="Commands" to="/docs/api/commands/add"}
20
+ List of Nuxt CLI commands to init, analyze, build, and preview your application.
21
+ ::
22
+ ::card{icon="i-lucide-package" title="Nuxt Kit" to="/docs/api/kit/modules"}
23
+ Understand Nuxt Kit utilities to create modules and control Nuxt.
24
+ ::
25
+ ::card{icon="i-lucide-brain" title="Advanced" to="/docs/api/advanced/hooks"}
26
+ Go deep in Nuxt internals with Nuxt lifecycle hooks.
27
+ ::
28
+ ::card{icon="i-lucide-cog" title="Nuxt Configuration" to="/docs/api/nuxt-config"}
29
+ Explore all Nuxt configuration options to customize your application.
30
+ ::
31
+ ::
@@ -0,0 +1,3 @@
1
+ title: 'Community'
2
+ titleTemplate: '%s · Nuxt Community'
3
+ icon: i-lucide-messages-square
@@ -0,0 +1,48 @@
1
+ ---
2
+ title: Getting Help
3
+ description: We're a friendly community of developers and we'd love to help.
4
+ navigation:
5
+ icon: i-lucide-life-buoy
6
+ ---
7
+
8
+ At some point, you may find that there's an issue you need some help with.
9
+
10
+ But don't worry! We're a friendly community of developers and we'd love to help.
11
+
12
+ ::card-group
13
+ ::card{icon="i-simple-icons-discord" title="Discord" to="https://go.nuxt.com/discord" target="_blank"}
14
+ Get real-time help, exchange with the core team and the community, and stay updated on the latest Nuxt news.
15
+ ::
16
+ ::card{icon="i-simple-icons-nuxt" title="Nuxters" to="https://nuxters.nuxt.com" target="_blank"}
17
+ Connect with other Nuxt enthusiasts.
18
+ ::
19
+ ::
20
+
21
+ ## "I can't figure out how to (...)."
22
+
23
+ You've read through these docs and you think it should be possible, but it's not clear how. The best thing is to [open a GitHub Discussion](https://github.com/nuxt/nuxt/discussions).
24
+
25
+ Please don't feel embarrassed about asking a question that you think is easy - we've all been there! ❤️
26
+
27
+ Everyone you'll encounter is helping out because they care, not because they are paid to do so. The kindest thing to do is make it easy for them to help you. Here are some ideas:
28
+
29
+ - _Explain what your objective is, not just the problem you're facing._ "I need to ensure my form inputs are accessible, so I'm trying to get the ids to match between server and client."
30
+ - _Make sure you've first read the docs and used your favorite search engine_. Let people know by saying something like "I've Googled for 'nuxt script setup' but I couldn't find code examples anywhere."
31
+ - _Explain what you've tried._ Tell people the kind of solutions you've experimented with, and why. Often this can make people's advice more relevant to your situation.
32
+ - _Share your code._ People probably won't be able to help if they just see an error message or a screenshot - but that all changes if you share your code in a copy/pasteable format - preferably in the form of a minimal reproduction like a CodeSandbox.
33
+
34
+ And finally, just ask the question! There's no need to [ask permission to ask a question](https://dontasktoask.com) or [wait for someone to reply to your 'hello'](https://www.nohello.com). If you do, you might not get a response because people are waiting for the whole question before engaging.
35
+
36
+ ## "Could there be a bug?"
37
+
38
+ Something isn't working the way that the docs say that it should. You're not sure if it's a bug. You've searched through the [open issues](https://github.com/nuxt/nuxt/issues) and [discussions](https://github.com/nuxt/nuxt/discussions) but you can't find anything. (if there is a closed issue, please create a new one)
39
+
40
+ We recommend taking a look at [how to report bugs](/docs/community/reporting-bugs). Nuxt is still in active development, and every issue helps make it better.
41
+
42
+ ## "I need professional help"
43
+
44
+ If the community couldn't provide the help you need in the time-frame you have, NuxtLabs offers professional support with the [Nuxt Experts](https://nuxt.com/enterprise/support).
45
+
46
+ The objective of the Nuxt Expert is to provide support to the Vue ecosystem, while also creating freelance opportunities for those contributing to open-source solutions, thus helping to maintain the sustainability of the ecosystem.
47
+
48
+ The Nuxt experts are Vue, Nuxt and Vite chosen contributors providing professional support and consulting services.
@@ -0,0 +1,50 @@
1
+ ---
2
+ title: 'Reporting Bugs'
3
+ description: 'One of the most valuable roles in open source is taking the time to report bugs helpfully.'
4
+ navigation.icon: i-lucide-bug
5
+ ---
6
+
7
+ Try as we might, we will never completely eliminate bugs.
8
+
9
+ Even if you can't fix the underlying code, reporting a bug well can enable someone else with a bit more familiarity with the codebase to spot a pattern or make a quick fix.
10
+
11
+ Here are a few key steps.
12
+
13
+ ## Is It Really a Bug?
14
+
15
+ Consider if you're looking to get help with something, or whether you think there's a bug with Nuxt itself. If it's the former, we'd love to help you - but the best way to do that is through [asking for help](/docs/community/getting-help) rather than reporting a bug.
16
+
17
+ ## Search the Issues
18
+
19
+ Search through the [open issues](https://github.com/nuxt/nuxt/issues) and [discussions](https://github.com/nuxt/nuxt/discussions) first. If you find anything that seems like the same bug, it's much better to comment on an existing thread than create a duplicate.
20
+
21
+ ## Create a Minimal Reproduction
22
+
23
+ It's important to be able to reproduce the bug reliably - in a minimal way and apart from the rest of your project. This narrows down what could be causing the issue and makes it possible for someone not only to find the cause, but also to test a potential solution.
24
+
25
+ Start with the Nuxt sandbox and add the **minimum** amount of code necessary to reproduce the bug you're experiencing.
26
+
27
+ ::note
28
+ If your issue concerns Vue or Vite, please try to reproduce it first with the Vue SSR starter.
29
+ ::
30
+
31
+ **Nuxt**:
32
+
33
+ ::card-group
34
+ :card{title="Nuxt on StackBlitz" icon="i-simple-icons-stackblitz" to="https://nuxt.new/s/v3" target="_blank"}
35
+ :card{title="Nuxt on CodeSandbox" icon="i-simple-icons-codesandbox" to="https://nuxt.new/c/v3" target="_blank"}
36
+ ::
37
+
38
+ **Vue**:
39
+
40
+ ::card-group
41
+ :card{title="Vue SSR on StackBlitz" icon="i-simple-icons-stackblitz" to="https://stackblitz.com/github/nuxt-contrib/vue3-ssr-starter/tree/main?terminal=dev" target="_blank"}
42
+ :card{title="Vue SSR on CodeSandbox" icon="i-simple-icons-codesandbox" to="https://codesandbox.io/s/github/nuxt-contrib/vue3-ssr-starter/main" target="_blank"}
43
+ :card{title="Vue SSR Template on GitHub" icon="i-simple-icons-github" to="https://github.com/nuxt-contrib/vue3-ssr-starter/generate" target="_blank"}
44
+ ::
45
+
46
+ Once you've reproduced the issue, remove as much code from your reproduction as you can (while still recreating the bug). The time spent making the reproduction as minimal as possible will make a huge difference to whoever sets out to fix the issue.
47
+
48
+ ## Figure Out What the Cause Might Be
49
+
50
+ With a Nuxt project, there are lots of moving pieces - from [Nuxt modules](/modules) to [other JavaScript libraries](https://www.npmjs.com). Try to report the bug at the most relevant and specific place. That will likely be the Nuxt module causing an issue, or the upstream library that Nuxt is depending on.
@@ -0,0 +1,205 @@
1
+ ---
2
+ title: 'Contribution'
3
+ description: 'Nuxt is a community project - and so we love contributions of all kinds! ❤️'
4
+ navigation.icon: i-lucide-git-pull-request
5
+ ---
6
+
7
+ There is a range of different ways you might be able to contribute to the Nuxt ecosystem.
8
+
9
+ ## Ecosystem
10
+
11
+ The Nuxt ecosystem includes many different projects and organizations:
12
+
13
+ * [nuxt/](https://github.com/nuxt) - core repositories for the Nuxt framework itself. [**nuxt/nuxt**](https://github.com/nuxt/nuxt) contains the Nuxt framework (both versions 2 and 3).
14
+ * [nuxt-modules/](https://github.com/nuxt-modules) - community-contributed and maintained modules and libraries. There is a [process to migrate a module](/docs/guide/going-further/modules/#joining-nuxt-modules-and-nuxtjs) to `nuxt-modules`. While these modules have individual maintainers, they are not dependent on a single person.
15
+ * [unjs/](https://github.com/unjs) - many of these libraries are used throughout the Nuxt ecosystem. They are designed to be universal libraries that are framework- and environment-agnostic. We welcome contributions and usage by other frameworks and projects.
16
+
17
+ ## How To Contribute
18
+
19
+ ### Triage Issues and Help Out in Discussions
20
+
21
+ Check out the issues and discussions for the project you want to help. For example, here are [the issues board](https://github.com/nuxt/nuxt/issues) and [discussions](https://github.com/nuxt/nuxt/discussions) for Nuxt. Helping other users, sharing workarounds, creating reproductions, or even poking into a bug a little bit and sharing your findings makes a huge difference.
22
+
23
+ ### Creating an Issue
24
+
25
+ Thank you for taking the time to create an issue! ❤️
26
+
27
+ * **Reporting bugs**: Check out [our guide](/docs/community/reporting-bugs) for some things to do before opening an issue.
28
+
29
+ * **Feature requests**: Check that there is not an existing issue or discussion covering the scope of the feature you have in mind. If the feature is to another part of the Nuxt ecosystem (such as a module), please consider raising a feature request there first. If the feature you have in mind is general or the API is not entirely clear, consider opening a discussion in the **Ideas** section to discuss with the community first.
30
+
31
+ We'll do our best to follow our [internal issue decision making flowchart](https://mermaid.live/view#pako:eNqFlE1v2zAMhv8K4UuToslhx2Bo0TZt12Edhm7YMCAXWqJtorLk6qOpkfS_j7KdfpyWQ-BQr8mHL6nsCuU0FauiMm6rGvQRfq03FuRzvvvTYIQHthpcBT_ugQNwPHuZjheLxf4i1VDx8x4udrf5EBCOQvSsYg4ffS79KS9pmX9QALTgyid2KYB7Ih-4bmKWbDk2YB0E1gRUVaRi-FDmmjAmT3u4nB3DmoNKIUA1BsGSohA49jnVMQhHbDh_EZQUImyxh-gAtfaiG-KWSJ-N8nt6YtpCdgEeE5rXPOdav5YwWJIJU7zrvNADV9C7JBIyIC07Wxupkx3LFQ5vCkguRno5f9fP2qnUko0Y2dk9rGdvHAa9IIhVGlCp5FFNPN-ce4DKeXBd53xMliOLp9IZtyORQVsnrGm-WJzejtUu5fFqdr5FGQ3bLslYvGthjZbJTLpReZG5_lLYw7XQ_CbPVT92ws9gnEJj-v84dk-PiaXnmF1XGAaPsOsMKywNvYmG80ZohV8k4wDR9_N3KN_dHm5mh1lnkM5FsYzRfNiTvJoT5gnQsl6uxjqXLhkNQ9syHJ0UZZ8ERUIlNShr6N8gZDEliR-ow7QZa0fhY4LoHLRo-8N7ZxPwjRj5ZZYXpvOSNs9v3Jjs8NXB4ets92xan3zydXZHvj64lKMayh4-gZC1bjASW2ipLeWuzIuToiXfImu5rbucclMIc0ubYiWPGv3DptjYF9Fhiu5nb1Wxij7RSZE6jZHWjLXHtlhVaIJESXN0_m68_sO_wMs_oO9gyg) when responding to issues.
32
+
33
+ ### Send a Pull Request
34
+
35
+ We always welcome pull requests! ❤️
36
+
37
+ #### Before You Start
38
+
39
+ Before you fix a bug, we recommend that you check whether **there's an issue that describes it**, as it's possible it's a documentation issue or that there is some context that would be helpful to know.
40
+
41
+ If you're working on a feature, then we ask that you **open a feature request issue first** to discuss with the maintainers whether the feature is desired - and the design of those features. This helps save time for both the maintainers and the contributors and means that features can be shipped faster. The issue **should be confirmed** by a framework team member before building out a feature in a pull request.
42
+
43
+ For typo fixes, it's recommended to batch multiple typo fixes into one pull request to maintain a cleaner commit history.
44
+
45
+ For bigger changes to Nuxt itself, we recommend that you first [create a Nuxt module](#create-a-module) and implement the feature there. This allows for quick proof-of-concept. You can then [create an RFC](#make-an-rfc) in the form of a discussion. As users adopt it and you gather feedback, it can then be refined and either added to Nuxt core or continue as a standalone module.
46
+
47
+ #### Commit Conventions
48
+
49
+ We use [Conventional Commits](https://www.conventionalcommits.org) for commit messages, which [allows a changelog to be auto-generated](https://github.com/unjs/changelogen) based on the commits. Please read the guide through if you aren't familiar with it already.
50
+
51
+ Note that `fix:` and `feat:` are for **actual code changes** (that might affect logic). For typo or document changes, use `docs:` or `chore:` instead:
52
+
53
+ * ~~`fix: typo`~~ -> `docs: fix typo`
54
+
55
+ If you are working in a project with a monorepo, like `nuxt/nuxt`, ensure that you specify the main scope of your commit in brackets. For example: `feat(nuxi): add 'do-magic' command`.
56
+
57
+ #### Making the Pull Request
58
+
59
+ If you don't know how to send a pull request, we recommend reading [the guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
60
+
61
+ When sending a pull request, make sure your PR's title also follows the [Commit Convention](#commit-conventions).
62
+
63
+ If your PR fixes or resolves existing issues, please make sure you mention them in the PR description.
64
+
65
+ It's ok to have multiple commits in a single PR; you don't need to rebase or force push for your changes as we will use `Squash and Merge` to squash the commits into one commit when merging.
66
+
67
+ We do not add any commit hooks to allow for quick commits. But before you make a pull request, you should ensure that any lint/test scripts are passing.
68
+
69
+ In general, please also make sure that there are no _unrelated_ changes in a PR. For example, if your editor has made any changes to whitespace or formatting elsewhere in a file that you edited, please revert these so it is more obvious what your PR changes. And please avoid including multiple unrelated features or fixes in a single PR. If it is possible to separate them, it is better to have multiple PRs to review and merge separately. In general, a PR should do _one thing only_.
70
+
71
+ #### Once You've Made a Pull Request
72
+
73
+ Once you've made a pull request, we'll do our best to review it promptly.
74
+
75
+ If we assign it to a maintainer, then that means that person will take special care to review it and implement any changes that may be required.
76
+
77
+ If we request changes on a PR, please ignore the red text! It doesn't mean we think it's a bad PR - it's just a way of easily telling the status of a list of pull requests at a glance.
78
+
79
+ If we mark a PR as 'pending', that means we likely have another task to do in reviewing the PR - it's an internal note-to-self, and not necessarily a reflection on whether the PR is a good idea or not. We will do our best to explain via a comment the reason for the pending status.
80
+
81
+ We'll do our best to follow [our PR decision making flowchart](https://mermaid.live/view#pako:eNp9VE1v2kAQ_SsjXzBSEqlALlaUisSh0ACK2l4qcVm8Y9hi7672Iwly-O-ZtYPt5FAOCHbee_PmzdpVlCmOURLlhXrJ9sw4-JNuJNBnWs1UQafIQVjrERyWumAOv58-AJeXt29_0b7BXbWwwL0uRPa1vlZvcB_fF8oiMMmB2QM4BXkt3UoON7Lh3LWaDz2SVkK6QGt7DHvw0CKt5sxCKaQoWQEGtVHcZ04oGdw04LTVngW_LHOeFcURGGz97mw6PSv-iJdsi0UCA4nI7SfNwc3W3JZit3eQ1SZFDlKB15yswQ2MgbOjbYeatY3n8bcr-IWlekYYaJRcyB04I9gOB1CEfkF5dAVTzmFAtnqn4-bUYAiMMmHZgWhNPRhgus5mW2BATxq0NkIZ4Y4NbNjzE2ZchBzcHmGLe_ZMSKCcyRXyLrVFa_5n_PBK2xKy3kk9eOjULUdltk6C8kI-7NFDr8f4EVGDoqlp-wa4sJm3ltIMIuZ_mTQXJyTSkQZtunPqsKxShV9GKdkBYe1fHXjpbcjlvONlO9Kqx_M7YHmOmav_luxfE5zKwVs09hM5DLSupgYDlr5flDkwo7ykixKG-xDsUly1LZ-uY32dgDc7lG7YqwbNp0msJwmIUivjWFtfd-xRrEcJ7Omydz37qFplHOtxEp4GskI2qB5dRCWakglOz3oV8JuITJa4iRL6yZk5bKKNPBGOead-H2UWJc54vIiaW53SPgwrz4fIhVNm1bw76lfI6R2_MW21) when responding and reviewing to pull requests.
82
+
83
+ ### Create a Module
84
+
85
+ If you've built something with Nuxt that's cool, why not [extract it into a module](/docs/guide/going-further/modules), so it can be shared with others? We have [many excellent modules already](/modules), but there's always room for more.
86
+
87
+ If you need help while building it, feel free to [check in with us](/docs/community/getting-help).
88
+
89
+ ### Make an RFC
90
+
91
+ We highly recommend [creating a module](#create-a-module) first to test out big new features and gain community adoption.
92
+
93
+ If you have done this already, or it's not appropriate to create a new module, then please start by creating a new discussion. Make sure it explains your thinking as clearly as possible. Include code examples or function signatures for new APIs. Reference existing issues or pain points with examples.
94
+
95
+ If we think this should be an RFC, we'll change the category to RFC and broadcast it more widely for feedback.
96
+
97
+ An RFC will then move through the following stages:
98
+
99
+ * `rfc: active` - currently open for comment
100
+ * `rfc: approved` - approved by the Nuxt team
101
+ * `rfc: ready to implement` - an issue has been created and assigned to implement
102
+ * `rfc: shipped` - implemented
103
+ * `rfc: archived` - not approved, but archived for future reference
104
+
105
+ ### Conventions Across Ecosystem
106
+
107
+ The following conventions are _required_ within the `nuxt/` organization and recommended for other maintainers in the ecosystem.
108
+
109
+ #### Module Conventions
110
+
111
+ Modules should follow the [Nuxt module template](https://github.com/nuxt/starter/tree/module). See [module guide](/docs/guide/going-further/modules) for more information.
112
+
113
+ #### Use Core `unjs/` Libraries
114
+
115
+ We recommend the following libraries which are used throughout the ecosystem:
116
+
117
+ * [pathe](https://github.com/unjs/pathe) - universal path utilities (replacement for node `path`)
118
+ * [ufo](https://github.com/unjs/ufo) - URL parsing and joining utilities
119
+ * [unbuild](https://github.com/unjs/unbuild) - rollup-powered build system
120
+ * ... check out the rest of the [unjs/](https://github.com/unjs) organization for many more!
121
+
122
+ #### Use ESM Syntax and Default to `type: module`
123
+
124
+ Most of the Nuxt ecosystem can consume ESM directly. In general we advocate that you avoid using CJS-specific code, such as `__dirname` and `require` statements. You can [read more about ESM](/docs/guide/concepts/esm).
125
+
126
+ #### What's Corepack
127
+
128
+ [Corepack](https://nodejs.org/api/corepack.html) makes sure you are using the correct version for package manager when you run corresponding commands. Projects might have `packageManager` field in their `package.json`.
129
+
130
+ Under projects with configuration as shown below, Corepack will install `v7.5.0` of `pnpm` (if you don't have it already) and use it to run your commands.
131
+
132
+ ```jsonc [package.json]
133
+ {
134
+ "packageManager": "pnpm@7.5.0"
135
+ }
136
+ ```
137
+
138
+ #### Use ESLint
139
+
140
+ We use [ESLint](https://eslint.org) for both linting and formatting with [`@nuxt/eslint`](https://github.com/nuxt/eslint).
141
+
142
+ ##### IDE Setup
143
+
144
+ We recommend using [VS Code](https://code.visualstudio.com) along with the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint). If you would like, you can enable auto-fix and formatting when you save the code you are editing:
145
+
146
+ ```json [settings.json]
147
+ {
148
+ "editor.codeActionsOnSave": {
149
+ "source.fixAll": "never",
150
+ "source.fixAll.eslint": "explicit"
151
+ }
152
+ }
153
+ ```
154
+
155
+ #### No Prettier
156
+
157
+ Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run `yarn lint --fix`, `pnpm lint --fix`, or `bun run lint --fix` or referring the [ESLint section](#use-eslint) for IDE Setup.
158
+
159
+ If you have Prettier installed in your editor, we recommend you disable it when working on the project to avoid conflict.
160
+
161
+ #### Package Manager
162
+
163
+ We recommend `pnpm` as a package manager for modules, libraries and apps.
164
+
165
+ It is important to enable Corepack to ensure you are on the same version of the package manager as the project. Corepack is built-in to new node versions for seamless package manager integration.
166
+
167
+ To enable it, run
168
+
169
+ ```bash [Terminal]
170
+ corepack enable
171
+ ```
172
+
173
+ You only need to do this one time, after Node.js is installed on your computer.
174
+
175
+ ## Documentation Style Guide
176
+
177
+ Documentation is an essential part of Nuxt. We aim to be an intuitive framework - and a big part of that is making sure that both the developer experience and the docs are perfect across the ecosystem. 👌
178
+
179
+ Here are some tips that may help improve your documentation:
180
+
181
+ * Avoid subjective words like _simply_, _just_, _obviously..._ when possible.
182
+
183
+ Keep in mind your readers can have different backgrounds and experiences. Therefore, these words don't convey meaning and can be harmful.
184
+
185
+ ::caution{ icon="i-lucide-circle-x"}
186
+ Simply make sure the function returns a promise.
187
+ ::
188
+
189
+ ::tip{icon="i-lucide-circle-check"}
190
+ Make sure the function returns a [promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
191
+ ::
192
+
193
+ * Prefer [active voice](https://developers.google.com/tech-writing/one/active-voice).
194
+
195
+ ::caution{icon="i-lucide-circle-x"}
196
+ An error will be thrown by Nuxt.
197
+ ::
198
+
199
+ ::tip{icon="i-lucide-circle-check"}
200
+ Nuxt will throw an error.
201
+ ::
202
+
203
+ ::read-more{to="/docs/community/framework-contribution#documentation-guide"}
204
+ Learn how to contribute to the documentation.
205
+ ::