@nuxt/docs-nightly 4.1.1-29282087.9ed08339 → 4.1.1-29283054.32d56553

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 (99) hide show
  1. package/1.getting-started/01.introduction.md +1 -1
  2. package/1.getting-started/03.configuration.md +2 -2
  3. package/1.getting-started/04.views.md +15 -15
  4. package/1.getting-started/05.assets.md +6 -6
  5. package/1.getting-started/06.styling.md +8 -8
  6. package/1.getting-started/07.routing.md +7 -7
  7. package/1.getting-started/08.seo-meta.md +9 -9
  8. package/1.getting-started/09.transitions.md +15 -15
  9. package/1.getting-started/10.data-fetching.md +9 -9
  10. package/1.getting-started/11.state-management.md +7 -7
  11. package/1.getting-started/12.error-handling.md +1 -1
  12. package/1.getting-started/14.layers.md +2 -2
  13. package/1.getting-started/15.prerendering.md +2 -2
  14. package/1.getting-started/17.testing.md +1 -1
  15. package/1.getting-started/18.upgrade.md +7 -7
  16. package/2.guide/1.concepts/1.auto-imports.md +6 -6
  17. package/2.guide/1.concepts/10.nuxt-lifecycle.md +6 -6
  18. package/2.guide/1.concepts/2.vuejs-development.md +3 -3
  19. package/2.guide/1.concepts/3.rendering.md +2 -2
  20. package/2.guide/1.concepts/8.typescript.md +1 -1
  21. package/2.guide/2.directory-structure/1.app/1.components.md +18 -18
  22. package/2.guide/2.directory-structure/1.app/1.composables.md +11 -11
  23. package/2.guide/2.directory-structure/1.app/1.layouts.md +7 -7
  24. package/2.guide/2.directory-structure/1.app/1.middleware.md +3 -3
  25. package/2.guide/2.directory-structure/1.app/1.pages.md +15 -15
  26. package/2.guide/2.directory-structure/1.app/1.plugins.md +7 -7
  27. package/2.guide/2.directory-structure/1.app/1.utils.md +3 -3
  28. package/2.guide/2.directory-structure/1.app/3.app-config.md +2 -2
  29. package/2.guide/2.directory-structure/1.app/3.app.md +12 -12
  30. package/2.guide/2.directory-structure/1.content.md +2 -2
  31. package/2.guide/2.directory-structure/1.public.md +1 -1
  32. package/2.guide/2.directory-structure/1.server.md +3 -3
  33. package/2.guide/2.directory-structure/1.shared.md +3 -3
  34. package/2.guide/3.going-further/1.experimental-features.md +5 -5
  35. package/2.guide/3.going-further/10.runtime-config.md +2 -2
  36. package/2.guide/3.going-further/2.hooks.md +1 -1
  37. package/2.guide/3.going-further/6.nuxt-app.md +2 -2
  38. package/2.guide/3.going-further/7.layers.md +7 -7
  39. package/2.guide/4.recipes/1.custom-routing.md +1 -1
  40. package/2.guide/4.recipes/2.vite-plugin.md +1 -1
  41. package/2.guide/4.recipes/3.custom-usefetch.md +4 -4
  42. package/2.guide/4.recipes/4.sessions-and-authentication.md +4 -4
  43. package/2.guide/5.best-practices/performance.md +2 -2
  44. package/3.api/1.components/1.client-only.md +2 -2
  45. package/3.api/1.components/1.dev-only.md +1 -1
  46. package/3.api/1.components/1.nuxt-client-fallback.md +1 -1
  47. package/3.api/1.components/12.nuxt-route-announcer.md +2 -2
  48. package/3.api/1.components/2.nuxt-page.md +8 -8
  49. package/3.api/1.components/3.nuxt-layout.md +13 -13
  50. package/3.api/1.components/4.nuxt-link.md +9 -9
  51. package/3.api/1.components/5.nuxt-loading-indicator.md +2 -2
  52. package/3.api/1.components/7.nuxt-welcome.md +1 -1
  53. package/3.api/2.composables/on-prehydrate.md +1 -1
  54. package/3.api/2.composables/use-async-data.md +3 -3
  55. package/3.api/2.composables/use-cookie.md +1 -1
  56. package/3.api/2.composables/use-fetch.md +2 -2
  57. package/3.api/2.composables/use-lazy-async-data.md +1 -1
  58. package/3.api/2.composables/use-lazy-fetch.md +1 -1
  59. package/3.api/2.composables/use-nuxt-app.md +7 -7
  60. package/3.api/2.composables/use-nuxt-data.md +4 -4
  61. package/3.api/2.composables/use-preview-mode.md +1 -1
  62. package/3.api/2.composables/use-request-fetch.md +1 -1
  63. package/3.api/2.composables/use-request-header.md +1 -1
  64. package/3.api/2.composables/use-request-headers.md +1 -1
  65. package/3.api/2.composables/use-request-url.md +1 -1
  66. package/3.api/2.composables/use-response-header.md +3 -3
  67. package/3.api/2.composables/use-route-announcer.md +1 -1
  68. package/3.api/2.composables/use-router.md +5 -5
  69. package/3.api/2.composables/use-runtime-config.md +1 -1
  70. package/3.api/2.composables/use-seo-meta.md +3 -3
  71. package/3.api/2.composables/use-server-seo-meta.md +1 -1
  72. package/3.api/3.utils/$fetch.md +4 -4
  73. package/3.api/3.utils/abort-navigation.md +4 -4
  74. package/3.api/3.utils/add-route-middleware.md +5 -5
  75. package/3.api/3.utils/call-once.md +2 -2
  76. package/3.api/3.utils/create-error.md +1 -1
  77. package/3.api/3.utils/define-nuxt-component.md +2 -2
  78. package/3.api/3.utils/define-nuxt-route-middleware.md +3 -3
  79. package/3.api/3.utils/define-page-meta.md +12 -12
  80. package/3.api/3.utils/define-route-rules.md +1 -1
  81. package/3.api/3.utils/navigate-to.md +1 -1
  82. package/3.api/3.utils/on-nuxt-ready.md +1 -1
  83. package/3.api/3.utils/refresh-cookie.md +1 -1
  84. package/3.api/3.utils/refresh-nuxt-data.md +2 -2
  85. package/3.api/3.utils/set-page-layout.md +1 -1
  86. package/3.api/4.commands/add.md +7 -7
  87. package/3.api/5.kit/7.pages.md +1 -1
  88. package/3.api/5.kit/8.layout.md +1 -1
  89. package/3.api/5.kit/9.plugins.md +1 -1
  90. package/3.api/6.nuxt-config.md +11 -16
  91. package/6.bridge/4.plugins-and-middleware.md +3 -3
  92. package/6.bridge/6.meta.md +1 -1
  93. package/7.migration/2.configuration.md +2 -2
  94. package/7.migration/3.auto-imports.md +1 -1
  95. package/7.migration/5.plugins-and-middleware.md +2 -2
  96. package/7.migration/6.pages-and-layouts.md +8 -8
  97. package/7.migration/7.component-options.md +4 -4
  98. package/7.migration/8.runtime-config.md +1 -1
  99. package/package.json +1 -1
@@ -22,7 +22,7 @@ Using `$fetch` in components without wrapping it with [`useAsyncData`](/docs/api
22
22
 
23
23
  We recommend using [`useFetch`](/docs/api/composables/use-fetch) or [`useAsyncData`](/docs/api/composables/use-async-data) + `$fetch` to prevent double data fetching when fetching the component data.
24
24
 
25
- ```vue [app.vue]
25
+ ```vue [app/app.vue]
26
26
  <script setup lang="ts">
27
27
  // During SSR data is fetched twice, once on the server and once on the client.
28
28
  const dataTwice = await $fetch('/api/item')
@@ -39,7 +39,7 @@ const { data } = await useFetch('/api/item')
39
39
 
40
40
  You can use `$fetch` in any methods that are executed only on client-side.
41
41
 
42
- ```vue [pages/contact.vue]
42
+ ```vue [app/pages/contact.vue]
43
43
  <script setup lang="ts">
44
44
  async function contactForm() {
45
45
  await $fetch('/api/contact', {
@@ -70,7 +70,7 @@ However, during Server-Side Rendering, due to security risks such as **Server-Si
70
70
 
71
71
  ::code-group
72
72
 
73
- ```vue [pages/index.vue]
73
+ ```vue [app/pages/index.vue]
74
74
  <script setup lang="ts">
75
75
  // This will NOT forward headers or cookies during SSR
76
76
  const { data } = await useAsyncData(() => $fetch('/api/cookies'))
@@ -87,7 +87,7 @@ export default defineEventHandler((event) => {
87
87
 
88
88
  If you need to forward headers and cookies on the server, you must manually pass them:
89
89
 
90
- ```vue [pages/index.vue]
90
+ ```vue [app/pages/index.vue]
91
91
  <script setup lang="ts">
92
92
  // This will forward the user's headers and cookies to `/api/cookies`
93
93
  const requestFetch = useRequestFetch()
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::warning
12
- `abortNavigation` is only usable inside a [route middleware handler](/docs/guide/directory-structure/middleware).
12
+ `abortNavigation` is only usable inside a [route middleware handler](/docs/guide/directory-structure/app/middleware).
13
13
  ::
14
14
 
15
15
  ## Type
@@ -30,7 +30,7 @@ abortNavigation(err?: Error | string): false
30
30
 
31
31
  The example below shows how you can use `abortNavigation` in a route middleware to prevent unauthorized route access:
32
32
 
33
- ```ts [middleware/auth.ts]
33
+ ```ts [app/middleware/auth.ts]
34
34
  export default defineNuxtRouteMiddleware((to, from) => {
35
35
  const user = useState('user')
36
36
 
@@ -48,7 +48,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
48
48
 
49
49
  You can pass the error as a string:
50
50
 
51
- ```ts [middleware/auth.ts]
51
+ ```ts [app/middleware/auth.ts]
52
52
  export default defineNuxtRouteMiddleware((to, from) => {
53
53
  const user = useState('user')
54
54
 
@@ -62,7 +62,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
62
62
 
63
63
  You can pass the error as an [`Error`](https://developer.mozilla.org/pl/docs/Web/JavaScript/Reference/Global_Objects/Error) object, e.g. caught by the `catch`-block:
64
64
 
65
- ```ts [middleware/auth.ts]
65
+ ```ts [app/middleware/auth.ts]
66
66
  export default defineNuxtRouteMiddleware((to, from) => {
67
67
  try {
68
68
  /* code that might throw an error */
@@ -9,7 +9,7 @@ links:
9
9
  ---
10
10
 
11
11
  ::note
12
- Route middleware are navigation guards stored in the [`middleware/`](/docs/guide/directory-structure/middleware) directory of your Nuxt application (unless [set otherwise](/docs/api/nuxt-config#middleware)).
12
+ Route middleware are navigation guards stored in the [`app/middleware/`](/docs/guide/directory-structure/app/middleware) directory of your Nuxt application (unless [set otherwise](/docs/api/nuxt-config#middleware)).
13
13
  ::
14
14
 
15
15
  ## Type
@@ -51,7 +51,7 @@ An optional `options` argument lets you set the value of `global` to `true` to i
51
51
 
52
52
  Named route middleware is defined by providing a string as the first argument and a function as the second:
53
53
 
54
- ```ts [plugins/my-plugin.ts]
54
+ ```ts [app/plugins/my-plugin.ts]
55
55
  export default defineNuxtPlugin(() => {
56
56
  addRouteMiddleware('named-middleware', () => {
57
57
  console.log('named middleware added in Nuxt plugin')
@@ -59,7 +59,7 @@ export default defineNuxtPlugin(() => {
59
59
  })
60
60
  ```
61
61
 
62
- When defined in a plugin, it overrides any existing middleware of the same name located in the `middleware/` directory.
62
+ When defined in a plugin, it overrides any existing middleware of the same name located in the `app/middleware/` directory.
63
63
 
64
64
  ### Global Route Middleware
65
65
 
@@ -67,7 +67,7 @@ Global route middleware can be defined in two ways:
67
67
 
68
68
  - Pass a function directly as the first argument without a name. It will automatically be treated as global middleware and applied on every route change.
69
69
 
70
- ```ts [plugins/my-plugin.ts]
70
+ ```ts [app/plugins/my-plugin.ts]
71
71
  export default defineNuxtPlugin(() => {
72
72
  addRouteMiddleware((to, from) => {
73
73
  console.log('anonymous global middleware that runs on every route change')
@@ -77,7 +77,7 @@ Global route middleware can be defined in two ways:
77
77
 
78
78
  - Set an optional, third argument `{ global: true }` to indicate whether the route middleware is global.
79
79
 
80
- ```ts [plugins/my-plugin.ts]
80
+ ```ts [app/plugins/my-plugin.ts]
81
81
  export default defineNuxtPlugin(() => {
82
82
  addRouteMiddleware('global-middleware', (to, from) => {
83
83
  console.log('global middleware that runs on every route change')
@@ -26,7 +26,7 @@ This is useful for code that should be executed only once, such as logging an ev
26
26
 
27
27
  The default mode of `callOnce` is to run code only once. For example, if the code runs on the server it won't run again on the client. It also won't run again if you `callOnce` more than once on the client, for example by navigating back to this page.
28
28
 
29
- ```vue [app.vue]
29
+ ```vue [app/app.vue]
30
30
  <script setup lang="ts">
31
31
  const websiteConfig = useState('config')
32
32
 
@@ -39,7 +39,7 @@ await callOnce(async () => {
39
39
 
40
40
  It is also possible to run on every navigation while still avoiding the initial server/client double load. For this, it is possible to use the `navigation` mode:
41
41
 
42
- ```vue [app.vue]
42
+ ```vue [app/app.vue]
43
43
  <script setup lang="ts">
44
44
  const websiteConfig = useState('config')
45
45
 
@@ -25,7 +25,7 @@ If you throw an error created with `createError`:
25
25
 
26
26
  ### Example
27
27
 
28
- ```vue [pages/movies/[slug\\].vue]
28
+ ```vue [app/pages/movies/[slug\\].vue]
29
29
  <script setup lang="ts">
30
30
  const route = useRoute()
31
31
  const { data } = await useFetch(`/api/movies/${route.params.slug}`)
@@ -22,7 +22,7 @@ Using `<script setup lang="ts">` is the recommended way of declaring Vue compone
22
22
 
23
23
  If you choose not to use `setup()` in your app, you can use the `asyncData()` method within your component definition:
24
24
 
25
- ```vue [pages/index.vue]
25
+ ```vue [app/pages/index.vue]
26
26
  <script lang="ts">
27
27
  export default defineNuxtComponent({
28
28
  async asyncData() {
@@ -40,7 +40,7 @@ export default defineNuxtComponent({
40
40
 
41
41
  If you choose not to use `setup()` in your app, you can use the `head()` method within your component definition:
42
42
 
43
- ```vue [pages/index.vue]
43
+ ```vue [app/pages/index.vue]
44
44
  <script lang="ts">
45
45
  export default defineNuxtComponent({
46
46
  head(nuxtApp) {
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- Route middleware are stored in the [`middleware/`](/docs/guide/directory-structure/middleware) of your Nuxt application (unless [set otherwise](/docs/api/nuxt-config#middleware)).
11
+ Route middleware are stored in the [`app/middleware/`](/docs/guide/directory-structure/app/middleware) of your Nuxt application (unless [set otherwise](/docs/api/nuxt-config#middleware)).
12
12
 
13
13
  ## Type
14
14
 
@@ -36,7 +36,7 @@ Learn more about available properties of `RouteLocationNormalized` in the **[Vue
36
36
 
37
37
  You can use route middleware to throw errors and show helpful error messages:
38
38
 
39
- ```ts [middleware/error.ts]
39
+ ```ts [app/middleware/error.ts]
40
40
  export default defineNuxtRouteMiddleware((to) => {
41
41
  if (to.params.id === '1') {
42
42
  throw createError({ statusCode: 404, statusMessage: 'Page Not Found' })
@@ -50,7 +50,7 @@ The above route middleware will redirect a user to the custom error page defined
50
50
 
51
51
  Use [`useState`](/docs/api/composables/use-state) in combination with `navigateTo` helper function inside the route middleware to redirect users to different routes based on their authentication status:
52
52
 
53
- ```ts [middleware/auth.ts]
53
+ ```ts [app/middleware/auth.ts]
54
54
  export default defineNuxtRouteMiddleware((to, from) => {
55
55
  const auth = useState('auth')
56
56
 
@@ -8,9 +8,9 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- `definePageMeta` is a compiler macro that you can use to set metadata for your **page** components located in the [`pages/`](/docs/guide/directory-structure/pages) directory (unless [set otherwise](/docs/api/nuxt-config#pages)). This way you can set custom metadata for each static or dynamic route of your Nuxt application.
11
+ `definePageMeta` is a compiler macro that you can use to set metadata for your **page** components located in the [`app/pages/`](/docs/guide/directory-structure/app/pages) directory (unless [set otherwise](/docs/api/nuxt-config#pages)). This way you can set custom metadata for each static or dynamic route of your Nuxt application.
12
12
 
13
- ```vue [pages/some-page.vue]
13
+ ```vue [app/pages/some-page.vue]
14
14
  <script setup lang="ts">
15
15
  definePageMeta({
16
16
  layout: 'default'
@@ -18,7 +18,7 @@ definePageMeta({
18
18
  </script>
19
19
  ```
20
20
 
21
- :read-more{to="/docs/guide/directory-structure/pages#page-metadata"}
21
+ :read-more{to="/docs/guide/directory-structure/app/pages#page-metadata"}
22
22
 
23
23
  ## Type
24
24
 
@@ -56,7 +56,7 @@ interface PageMeta {
56
56
 
57
57
  - **Type**: `string`
58
58
 
59
- You may define a name for this page's route. By default, name is generated based on path inside the [`pages/` directory](/docs/guide/directory-structure/pages).
59
+ You may define a name for this page's route. By default, name is generated based on path inside the [`app/pages/` directory](/docs/guide/directory-structure/app/pages).
60
60
 
61
61
  **`path`**
62
62
 
@@ -104,7 +104,7 @@ interface PageMeta {
104
104
 
105
105
  - **Type**: `MiddlewareKey` | [`NavigationGuard`](https://router.vuejs.org/api/interfaces/NavigationGuard.html#navigationguard) | `Array<MiddlewareKey | NavigationGuard>`
106
106
 
107
- Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/docs/guide/directory-structure/middleware).
107
+ Define anonymous or named middleware directly within `definePageMeta`. Learn more about [route middleware](/docs/guide/directory-structure/app/middleware).
108
108
 
109
109
  **`pageTransition`**
110
110
 
@@ -142,7 +142,7 @@ interface PageMeta {
142
142
 
143
143
  - **Type**: `any`
144
144
 
145
- Apart from the above properties, you can also set **custom** metadata. You may wish to do so in a type-safe way by [augmenting the type of the `meta` object](/docs/guide/directory-structure/pages/#typing-custom-metadata).
145
+ Apart from the above properties, you can also set **custom** metadata. You may wish to do so in a type-safe way by [augmenting the type of the `meta` object](/docs/guide/directory-structure/app/pages/#typing-custom-metadata).
146
146
 
147
147
  ## Examples
148
148
 
@@ -154,7 +154,7 @@ The example below demonstrates:
154
154
  - how `keepalive` property makes sure that the `<modal>` component is not cached when switching between multiple components;
155
155
  - adding `pageType` as a custom property:
156
156
 
157
- ```vue [pages/some-page.vue]
157
+ ```vue [app/pages/some-page.vue]
158
158
  <script setup lang="ts">
159
159
  definePageMeta({
160
160
  key: (route) => route.fullPath,
@@ -170,9 +170,9 @@ definePageMeta({
170
170
 
171
171
  ### Defining Middleware
172
172
 
173
- The example below shows how the middleware can be defined using a `function` directly within the `definePageMeta` or set as a `string` that matches the middleware file name located in the `middleware/` directory:
173
+ The example below shows how the middleware can be defined using a `function` directly within the `definePageMeta` or set as a `string` that matches the middleware file name located in the `app/middleware/` directory:
174
174
 
175
- ```vue [pages/some-page.vue]
175
+ ```vue [app/pages/some-page.vue]
176
176
  <script setup lang="ts">
177
177
  definePageMeta({
178
178
  // define middleware as a function
@@ -207,7 +207,7 @@ The two routes "/test-category" and "/1234-post" match both `[postId]-[postSlug]
207
207
 
208
208
  To make sure that we are only matching digits (`\d+`) for `postId` in the `[postId]-[postSlug]` route, we can add the following to the `[postId]-[postSlug].vue` page template:
209
209
 
210
- ```vue [pages/[postId\\]-[postSlug\\].vue]
210
+ ```vue [app/pages/[postId\\]-[postSlug\\].vue]
211
211
  <script setup lang="ts">
212
212
  definePageMeta({
213
213
  path: '/:postId(\\d+)-:postSlug'
@@ -219,9 +219,9 @@ For more examples see [Vue Router's Matching Syntax](https://router.vuejs.org/gu
219
219
 
220
220
  ### Defining Layout
221
221
 
222
- You can define the layout that matches the layout's file name located (by default) in the [`layouts/` directory](/docs/guide/directory-structure/layouts). You can also disable the layout by setting the `layout` to `false`:
222
+ You can define the layout that matches the layout's file name located (by default) in the [`app/layouts/` directory](/docs/guide/directory-structure/app/layouts). You can also disable the layout by setting the `layout` to `false`:
223
223
 
224
- ```vue [pages/some-page.vue]
224
+ ```vue [app/pages/some-page.vue]
225
225
  <script setup lang="ts">
226
226
  definePageMeta({
227
227
  // set custom layout
@@ -14,7 +14,7 @@ This feature is experimental and in order to use it you must enable the `experim
14
14
 
15
15
  ## Usage
16
16
 
17
- ```vue [pages/index.vue]
17
+ ```vue [app/pages/index.vue]
18
18
  <script setup lang="ts">
19
19
  defineRouteRules({
20
20
  prerender: true
@@ -68,7 +68,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
68
68
 
69
69
  In this case, `navigateTo` will be executed but not returned, which may lead to unexpected behavior.
70
70
 
71
- :read-more{to="/docs/guide/directory-structure/middleware"}
71
+ :read-more{to="/docs/guide/directory-structure/app/middleware"}
72
72
 
73
73
  ### Navigating to an External URL
74
74
 
@@ -13,7 +13,7 @@ links:
13
13
  It is ideal for running code that should not block the initial rendering of your app.
14
14
  ::
15
15
 
16
- ```ts [plugins/ready.client.ts]
16
+ ```ts [app/plugins/ready.client.ts]
17
17
  export default defineNuxtPlugin(() => {
18
18
  onNuxtReady(async () => {
19
19
  const myAnalyticsLibrary = await import('my-big-analytics-library')
@@ -22,7 +22,7 @@ This is useful for updating the `useCookie` ref when we know the new cookie valu
22
22
 
23
23
  ## Usage
24
24
 
25
- ```vue [app.vue]
25
+ ```vue [app/app.vue]
26
26
  <script setup lang="ts">
27
27
  const tokenCookie = useCookie('token')
28
28
 
@@ -34,7 +34,7 @@ refreshNuxtData(keys?: string | string[])
34
34
 
35
35
  This example below refreshes all data being fetched using `useAsyncData` and `useFetch` in Nuxt application.
36
36
 
37
- ```vue [pages/some-page.vue]
37
+ ```vue [app/pages/some-page.vue]
38
38
  <script setup lang="ts">
39
39
  const refreshing = ref(false)
40
40
 
@@ -61,7 +61,7 @@ async function refreshAll () {
61
61
 
62
62
  This example below refreshes only data where the key matches to `count` and `user`.
63
63
 
64
- ```vue [pages/some-page.vue]
64
+ ```vue [app/pages/some-page.vue]
65
65
  <script setup lang="ts">
66
66
  const refreshing = ref(false)
67
67
 
@@ -12,7 +12,7 @@ links:
12
12
  `setPageLayout` allows you to dynamically change the layout of a page. It relies on access to the Nuxt context and therefore can only be called within the [Nuxt context](/docs/guide/going-further/nuxt-app#the-nuxt-context).
13
13
  ::
14
14
 
15
- ```ts [middleware/custom-layout.ts]
15
+ ```ts [app/middleware/custom-layout.ts]
16
16
  export default defineNuxtRouteMiddleware((to) => {
17
17
  // Set the layout on the route you are navigating _to_
18
18
  setPageLayout('other')
@@ -47,21 +47,21 @@ npx nuxt add plugin sockets --client
47
47
  * Modifier flags: `--mode client|server` or `--client` or `--server`
48
48
 
49
49
  ```bash [Terminal]
50
- # Generates `components/TheHeader.vue`
50
+ # Generates `app/components/TheHeader.vue`
51
51
  npx nuxt add component TheHeader
52
52
  ```
53
53
 
54
54
  ## `nuxt add composable`
55
55
 
56
56
  ```bash [Terminal]
57
- # Generates `composables/foo.ts`
57
+ # Generates `app/composables/foo.ts`
58
58
  npx nuxt add composable foo
59
59
  ```
60
60
 
61
61
  ## `nuxt add layout`
62
62
 
63
63
  ```bash [Terminal]
64
- # Generates `layouts/custom.vue`
64
+ # Generates `app/layouts/custom.vue`
65
65
  npx nuxt add layout custom
66
66
  ```
67
67
 
@@ -70,19 +70,19 @@ npx nuxt add layout custom
70
70
  * Modifier flags: `--mode client|server` or `--client`or `--server`
71
71
 
72
72
  ```bash [Terminal]
73
- # Generates `plugins/analytics.ts`
73
+ # Generates `app/plugins/analytics.ts`
74
74
  npx nuxt add plugin analytics
75
75
  ```
76
76
 
77
77
  ## `nuxt add page`
78
78
 
79
79
  ```bash [Terminal]
80
- # Generates `pages/about.vue`
80
+ # Generates `app/pages/about.vue`
81
81
  npx nuxt add page about
82
82
  ```
83
83
 
84
84
  ```bash [Terminal]
85
- # Generates `pages/category/[id].vue`
85
+ # Generates `app/pages/category/[id].vue`
86
86
  npx nuxt add page "category/[id]"
87
87
  ```
88
88
 
@@ -91,7 +91,7 @@ npx nuxt add page "category/[id]"
91
91
  * Modifier flags: `--global`
92
92
 
93
93
  ```bash [Terminal]
94
- # Generates `middleware/auth.ts`
94
+ # Generates `app/middleware/auth.ts`
95
95
  npx nuxt add middleware auth
96
96
  ```
97
97
 
@@ -10,7 +10,7 @@ links:
10
10
 
11
11
  ## `extendPages`
12
12
 
13
- In Nuxt, routes are automatically generated based on the structure of the files in the `pages` directory. However, there may be scenarios where you'd want to customize these routes. For instance, you might need to add a route for a dynamic page not generated by Nuxt, remove an existing route, or modify the configuration of a route. For such customizations, Nuxt offers the `extendPages` feature, which allows you to extend and alter the pages configuration.
13
+ In Nuxt, routes are automatically generated based on the structure of the files in the `app/pages` directory. However, there may be scenarios where you'd want to customize these routes. For instance, you might need to add a route for a dynamic page not generated by Nuxt, remove an existing route, or modify the configuration of a route. For such customizations, Nuxt offers the `extendPages` feature, which allows you to extend and alter the pages configuration.
14
14
 
15
15
  ::tip{icon="i-lucide-video" to="https://vueschool.io/lessons/extend-and-alter-nuxt-pages?friend=nuxt" target="_blank"}
16
16
  Watch Vue School video about extendPages.
@@ -82,7 +82,7 @@ export default defineNuxtModule({
82
82
 
83
83
  You can then use this layout in your pages:
84
84
 
85
- ```vue [pages/about.vue]
85
+ ```vue [app/pages/about.vue]
86
86
  <script setup lang="ts">
87
87
  definePageMeta({
88
88
  layout: 'custom',
@@ -8,7 +8,7 @@ links:
8
8
  size: xs
9
9
  ---
10
10
 
11
- Plugins are self-contained code that usually add app-level functionality to Vue. In Nuxt, plugins are automatically imported from the `plugins/` directory. However, if you need to ship a plugin with your module, Nuxt Kit provides the `addPlugin` and `addPluginTemplate` methods. These utils allow you to customize the plugin configuration to better suit your needs.
11
+ Plugins are self-contained code that usually add app-level functionality to Vue. In Nuxt, plugins are automatically imported from the `app/plugins/` directory. However, if you need to ship a plugin with your module, Nuxt Kit provides the `addPlugin` and `addPluginTemplate` methods. These utils allow you to customize the plugin configuration to better suit your needs.
12
12
 
13
13
  ## `addPlugin`
14
14
 
@@ -442,7 +442,7 @@ Any components in the directories configured here can be used throughout your pa
442
442
  }
443
443
  ```
444
444
 
445
- **See**: [`components/` directory documentation](https://nuxt.com/docs/guide/directory-structure/components)
445
+ **See**: [`app/components/` directory documentation](https://nuxt.com/docs/guide/directory-structure/app/components)
446
446
 
447
447
  ## css
448
448
 
@@ -576,21 +576,21 @@ It is better to stick with defaults unless needed.
576
576
  The assets directory (aliased as `~assets` in your build).
577
577
 
578
578
  - **Type**: `string`
579
- - **Default:** `"assets"`
579
+ - **Default:** `"app/assets"`
580
580
 
581
581
  ### `layouts`
582
582
 
583
583
  The layouts directory, each file of which will be auto-registered as a Nuxt layout.
584
584
 
585
585
  - **Type**: `string`
586
- - **Default:** `"layouts"`
586
+ - **Default:** `"app/layouts"`
587
587
 
588
588
  ### `middleware`
589
589
 
590
590
  The middleware directory, each file of which will be auto-registered as a Nuxt middleware.
591
591
 
592
592
  - **Type**: `string`
593
- - **Default:** `"middleware"`
593
+ - **Default:** `"app/middleware"`
594
594
 
595
595
  ### `modules`
596
596
 
@@ -604,14 +604,14 @@ The modules directory, each file in which will be auto-registered as a Nuxt modu
604
604
  The directory which will be processed to auto-generate your application page routes.
605
605
 
606
606
  - **Type**: `string`
607
- - **Default:** `"pages"`
607
+ - **Default:** `"app/pages"`
608
608
 
609
609
  ### `plugins`
610
610
 
611
611
  The plugins directory, each file of which will be auto-registered as a Nuxt plugin.
612
612
 
613
613
  - **Type**: `string`
614
- - **Default:** `"plugins"`
614
+ - **Default:** `"app/plugins"`
615
615
 
616
616
  ### `public`
617
617
 
@@ -627,11 +627,6 @@ The shared directory. This directory is shared between the app and the server.
627
627
  - **Type**: `string`
628
628
  - **Default:** `"shared"`
629
629
 
630
- ### `static`
631
-
632
- - **Type**: `string`
633
- - **Default:** `"public"`
634
-
635
630
  ## esbuild
636
631
 
637
632
  ### `options`
@@ -1376,7 +1371,7 @@ ignoreOptions: {
1376
1371
 
1377
1372
  ## ignorePrefix
1378
1373
 
1379
- Any file in `pages/`, `layouts/`, `middleware/`, and `public/` directories will be ignored during the build process if its filename starts with the prefix specified by `ignorePrefix`. This is intended to prevent certain files from being processed or served in the built application. By default, the `ignorePrefix` is set to '-', ignoring any files starting with '-'.
1374
+ Any file in `app/pages/`, `app/layouts/`, `app/middleware/`, and `public/` directories will be ignored during the build process if its filename starts with the prefix specified by `ignorePrefix`. This is intended to prevent certain files from being processed or served in the built application. By default, the `ignorePrefix` is set to '-', ignoring any files starting with '-'.
1380
1375
 
1381
1376
  - **Type**: `string`
1382
1377
  - **Default:** `"-"`
@@ -1385,7 +1380,7 @@ Any file in `pages/`, `layouts/`, `middleware/`, and `public/` directories will
1385
1380
 
1386
1381
  Configure how Nuxt auto-imports composables into your application.
1387
1382
 
1388
- **See**: [Nuxt documentation](https://nuxt.com/docs/guide/directory-structure/composables)
1383
+ **See**: [Nuxt documentation](https://nuxt.com/docs/guide/directory-structure/app/composables)
1389
1384
 
1390
1385
  ### `dirs`
1391
1386
 
@@ -1408,7 +1403,7 @@ imports: {
1408
1403
 
1409
1404
  ### `scan`
1410
1405
 
1411
- Whether to scan your `composables/` and `utils/` directories for composables to auto-import. Auto-imports registered by Nuxt or other modules, such as imports from `vue` or `nuxt`, will still be enabled.
1406
+ Whether to scan your `app/composables/` and `app/utils/` directories for composables to auto-import. Auto-imports registered by Nuxt or other modules, such as imports from `vue` or `nuxt`, will still be enabled.
1412
1407
 
1413
1408
  - **Type**: `boolean`
1414
1409
  - **Default:** `true`
@@ -1655,7 +1650,7 @@ treeShake: { client: { myPackage: ['useServerOnlyComposable'] } }
1655
1650
 
1656
1651
  ## pages
1657
1652
 
1658
- Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `pages/` directory in your source folder.
1653
+ Whether to use the vue-router integration in Nuxt 3. If you do not provide a value it will be enabled if you have a `app/pages/` directory in your source folder.
1659
1654
 
1660
1655
  Additionally, you can provide a glob pattern or an array of patterns to scan only certain files for pages.
1661
1656
 
@@ -1681,7 +1676,7 @@ and these plugins do not need to be listed in `nuxt.config` unless you
1681
1676
  need to customize their order. All plugins are deduplicated by their src path.
1682
1677
  ::
1683
1678
 
1684
- **See**: [`plugins/` directory documentation](https://nuxt.com/docs/guide/directory-structure/plugins)
1679
+ **See**: [`app/plugins/` directory documentation](https://nuxt.com/docs/guide/directory-structure/plugins)
1685
1680
 
1686
1681
  **Example**:
1687
1682
  ```js
@@ -9,7 +9,7 @@ You can now migrate to the Nuxt 3 plugins API, which is slightly different in fo
9
9
 
10
10
  Plugins now take only one argument (`nuxtApp`). You can find out more in [the docs](/docs/guide/directory-structure/plugins).
11
11
 
12
- ```js [plugins/hello.ts]
12
+ ```js [app/plugins/hello.ts]
13
13
  export default defineNuxtPlugin(nuxtApp => {
14
14
  nuxtApp.provide('injected', () => 'my injected function')
15
15
  // now available on `nuxtApp.$injected`
@@ -28,7 +28,7 @@ Although a compatibility interface is provided via `nuxtApp.vueApp` you should a
28
28
 
29
29
  You can now migrate to the Nuxt 3 middleware API, which is slightly different in format from Nuxt 2.
30
30
 
31
- Middleware now take only two argument (`to`, `from`). You can find out more in [the docs](/docs/guide/directory-structure/middleware).
31
+ Middleware now take only two argument (`to`, `from`). You can find out more in [the docs](/docs/guide/directory-structure/app/middleware).
32
32
 
33
33
  ```ts twoslash
34
34
  export default defineNuxtRouteMiddleware((to) => {
@@ -39,7 +39,7 @@ export default defineNuxtRouteMiddleware((to) => {
39
39
  ```
40
40
 
41
41
  ::important
42
- Use of `defineNuxtRouteMiddleware` is not supported outside of the middleware directory.
42
+ Use of `defineNuxtRouteMiddleware` is not supported outside of the `app/middleware` directory.
43
43
  ::
44
44
 
45
45
  ## definePageMeta
@@ -106,7 +106,7 @@ Possible breaking change: `head` receives the nuxt app but cannot access the com
106
106
 
107
107
  If you want to use a function (for full control), then this cannot be set in your nuxt.config, and it is recommended instead to set it within your `/layouts` directory.
108
108
 
109
- ```vue [layouts/default.vue]
109
+ ```vue [app/layouts/default.vue]
110
110
  <script setup lang="ts">
111
111
  useHead({
112
112
  titleTemplate: (titleChunk) => {
@@ -227,7 +227,7 @@ export const useMainStore = defineStore('main', {
227
227
 
228
228
  Create a [plugin](/docs/guide/directory-structure/plugins) file to globalize your store:
229
229
 
230
- ```ts [plugins/pinia.ts]
230
+ ```ts [app/plugins/pinia.ts]
231
231
  import { useMainStore } from '~/store'
232
232
 
233
233
  export default defineNuxtPlugin(({ $pinia }) => {
@@ -243,7 +243,7 @@ If you want to keep using Vuex, you can manually migrate to Vuex 4 following [th
243
243
 
244
244
  Once it's done you will need to add the following plugin to your Nuxt app:
245
245
 
246
- ```ts [plugins/vuex.ts]
246
+ ```ts [app/plugins/vuex.ts]
247
247
  import store from '~/store'
248
248
 
249
249
  export default defineNuxtPlugin(nuxtApp => {
@@ -11,7 +11,7 @@ In the rest of the migration documentation, you will notice that key Nuxt and Vu
11
11
 
12
12
  ## Migration
13
13
 
14
- 1. If you have been using `@nuxt/components` in Nuxt 2, you can remove `components: true` in your `nuxt.config`. If you had a more complex setup, then note that the component options have changed somewhat. See the [components documentation](/docs/guide/directory-structure/components) for more information.
14
+ 1. If you have been using `@nuxt/components` in Nuxt 2, you can remove `components: true` in your `nuxt.config`. If you had a more complex setup, then note that the component options have changed somewhat. See the [components documentation](/docs/guide/directory-structure/app/components) for more information.
15
15
 
16
16
  ::tip
17
17
  You can look at `.nuxt/types/components.d.ts` and `.nuxt/types/imports.d.ts` to see how Nuxt has resolved your components and composable auto-imports.
@@ -40,7 +40,7 @@ Read more about the format of `nuxtApp`.
40
40
  ### Migration
41
41
 
42
42
  1. Migrate your plugins to use the `defineNuxtPlugin` helper function.
43
- 2. Remove any entries in your `nuxt.config` plugins array that are located in your `plugins/` folder. All files in this directory at the top level (and any index files in any subdirectories) will be automatically registered. Instead of setting `mode` to `client` or `server`, you can indicate this in the file name. For example, `~/plugins/my-plugin.client.ts` will only be loaded on client-side.
43
+ 2. Remove any entries in your `nuxt.config` plugins array that are located in your `app/plugins/` folder. All files in this directory at the top level (and any index files in any subdirectories) will be automatically registered. Instead of setting `mode` to `client` or `server`, you can indicate this in the file name. For example, `~/plugins/my-plugin.client.ts` will only be loaded on client-side.
44
44
 
45
45
  ## Route Middleware
46
46
 
@@ -72,7 +72,7 @@ Much like Nuxt 2, route middleware placed in your `~/middleware` folder is autom
72
72
 
73
73
  `navigateTo` is one of a number of route helper functions.
74
74
 
75
- :read-more{to="/docs/guide/directory-structure/middleware"}
75
+ :read-more{to="/docs/guide/directory-structure/app/middleware"}
76
76
 
77
77
  ### Migration
78
78