@nuxt/docs-nightly 4.5.1-29752449.30d24817 → 4.5.2-2610052030-052d82e
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.
- package/1.getting-started/01.introduction.md +8 -8
- package/1.getting-started/02.installation.md +2 -4
- package/1.getting-started/03.configuration.md +16 -16
- package/1.getting-started/04.views.md +8 -8
- package/1.getting-started/05.assets.md +10 -10
- package/1.getting-started/06.styling.md +10 -10
- package/1.getting-started/07.routing.md +15 -15
- package/1.getting-started/08.seo-meta.md +15 -15
- package/1.getting-started/09.transitions.md +10 -10
- package/1.getting-started/10.data-fetching.md +61 -47
- package/1.getting-started/11.state-management.md +11 -11
- package/1.getting-started/12.error-handling.md +20 -18
- package/1.getting-started/13.server.md +7 -7
- package/1.getting-started/14.layers.md +6 -6
- package/1.getting-started/15.prerendering.md +22 -28
- package/1.getting-started/16.deployment.md +22 -6
- package/1.getting-started/17.testing.md +200 -21
- package/1.getting-started/18.upgrade.md +78 -278
- package/2.directory-structure/0.nuxt.md +2 -2
- package/2.directory-structure/0.output.md +3 -3
- package/2.directory-structure/1.app/1.assets.md +3 -3
- package/2.directory-structure/1.app/1.components.md +26 -109
- package/2.directory-structure/1.app/1.composables.md +5 -5
- package/2.directory-structure/1.app/1.layouts.md +10 -10
- package/2.directory-structure/1.app/1.middleware.md +14 -10
- package/2.directory-structure/1.app/1.pages.md +25 -20
- package/2.directory-structure/1.app/1.plugins.md +7 -7
- package/2.directory-structure/1.app/1.utils.md +9 -5
- package/2.directory-structure/1.app/3.app-config.md +7 -7
- package/2.directory-structure/1.app/3.app.md +6 -6
- package/2.directory-structure/1.app/3.error.md +1 -1
- package/2.directory-structure/1.content.md +1 -1
- package/2.directory-structure/1.layers.md +13 -13
- package/2.directory-structure/1.modules.md +3 -3
- package/2.directory-structure/1.node_modules.md +1 -1
- package/2.directory-structure/1.server.md +33 -14
- package/2.directory-structure/1.shared.md +7 -5
- package/2.directory-structure/1.test.md +25 -0
- package/2.directory-structure/2.env.md +7 -7
- package/2.directory-structure/2.nuxtignore.md +3 -3
- package/2.directory-structure/2.nuxtrc.md +3 -3
- package/2.directory-structure/3.nuxt-config.md +2 -2
- package/2.directory-structure/3.tsconfig.md +21 -11
- package/2.directory-structure/index.md +29 -25
- package/3.guide/0.index.md +6 -6
- package/3.guide/1.concepts/1.rendering.md +76 -12
- package/3.guide/1.concepts/10.vuejs-development.md +73 -8
- package/3.guide/1.concepts/2.nuxt-lifecycle.md +18 -18
- package/3.guide/1.concepts/3.auto-imports.md +11 -11
- package/3.guide/1.concepts/4.server-engine.md +6 -6
- package/3.guide/1.concepts/5.modules.md +4 -4
- package/3.guide/1.concepts/6.server-components.md +198 -0
- package/3.guide/1.concepts/7.esm.md +5 -5
- package/3.guide/1.concepts/8.typescript.md +9 -9
- package/3.guide/2.best-practices/accessibility.md +155 -0
- package/3.guide/2.best-practices/hydration.md +5 -5
- package/3.guide/2.best-practices/performance.md +13 -9
- package/3.guide/3.ai/1.mcp.md +104 -19
- package/3.guide/4.modules/2.module-anatomy.md +5 -5
- package/3.guide/4.modules/3.recipes-basics.md +8 -8
- package/3.guide/4.modules/4.module-dependencies.md +1 -1
- package/3.guide/4.modules/5.recipes-advanced.md +6 -8
- package/3.guide/4.modules/6.testing.md +2 -2
- package/3.guide/4.modules/7.best-practices.md +2 -2
- package/3.guide/4.modules/9.server-compatibility.md +215 -0
- package/3.guide/4.modules/index.md +9 -9
- package/3.guide/5.recipes/1.custom-routing.md +15 -11
- package/3.guide/5.recipes/2.vite-plugin.md +3 -3
- package/3.guide/5.recipes/3.custom-usefetch.md +5 -5
- package/3.guide/5.recipes/4.sessions-and-authentication.md +2 -2
- package/3.guide/5.recipes/5.mostly-static-sites.md +127 -0
- package/3.guide/6.going-further/1.events.md +1 -1
- package/3.guide/6.going-further/1.experimental-features.md +254 -22
- package/3.guide/6.going-further/1.features.md +42 -6
- package/3.guide/6.going-further/1.internals.md +10 -10
- package/3.guide/6.going-further/10.runtime-config.md +28 -6
- package/3.guide/6.going-further/11.nightly-release-channel.md +1 -1
- package/3.guide/6.going-further/2.hooks.md +6 -6
- package/3.guide/6.going-further/4.kit.md +4 -4
- package/3.guide/6.going-further/5.server-imports.md +221 -0
- package/3.guide/6.going-further/6.nuxt-app.md +7 -7
- package/3.guide/6.going-further/7.layers.md +13 -13
- package/3.guide/6.going-further/8.builders.md +38 -14
- package/4.api/1.components/1.nuxt-client-fallback.md +1 -1
- package/4.api/1.components/10.nuxt-picture.md +1 -1
- package/4.api/1.components/11.teleports.md +1 -1
- package/4.api/1.components/12.nuxt-route-announcer.md +5 -3
- package/4.api/1.components/14.nuxt-announcer.md +3 -3
- package/4.api/1.components/2.nuxt-page.md +5 -5
- package/4.api/1.components/3.nuxt-layout.md +8 -8
- package/4.api/1.components/4.nuxt-link.md +6 -4
- package/4.api/1.components/5.nuxt-loading-indicator.md +3 -3
- package/4.api/1.components/6.nuxt-error-boundary.md +1 -1
- package/4.api/1.components/8.nuxt-island.md +5 -5
- package/4.api/2.composables/create-use-async-data.md +51 -8
- package/4.api/2.composables/create-use-fetch.md +126 -9
- package/4.api/2.composables/use-announcer.md +3 -3
- package/4.api/2.composables/use-app-config.md +1 -1
- package/4.api/2.composables/use-async-data.md +19 -11
- package/4.api/2.composables/use-cookie.md +22 -6
- package/4.api/2.composables/use-error.md +1 -1
- package/4.api/2.composables/use-fetch.md +14 -10
- package/4.api/2.composables/use-head-safe.md +2 -2
- package/4.api/2.composables/use-head.md +2 -2
- package/4.api/2.composables/use-hydration.md +1 -1
- package/4.api/2.composables/use-layout.md +1 -1
- package/4.api/2.composables/use-lazy-async-data.md +8 -8
- package/4.api/2.composables/use-lazy-fetch.md +11 -11
- package/4.api/2.composables/use-loading-indicator.md +2 -2
- package/4.api/2.composables/use-nuxt-app.md +13 -13
- package/4.api/2.composables/use-nuxt-data.md +1 -1
- package/4.api/2.composables/use-preview-mode.md +3 -3
- package/4.api/2.composables/use-request-event.md +29 -3
- package/4.api/2.composables/use-request-fetch.md +2 -2
- package/4.api/2.composables/use-request-header.md +1 -1
- package/4.api/2.composables/use-request-headers.md +1 -1
- package/4.api/2.composables/use-request-url.md +1 -1
- package/4.api/2.composables/use-response-header.md +2 -2
- package/4.api/2.composables/use-route-announcer.md +4 -2
- package/4.api/2.composables/use-route.md +2 -2
- package/4.api/2.composables/use-router.md +5 -5
- package/4.api/2.composables/use-runtime-config.md +5 -5
- package/4.api/2.composables/use-runtime-hook.md +1 -1
- package/4.api/2.composables/use-seo-meta.md +3 -3
- package/4.api/2.composables/use-server-seo-meta.md +5 -5
- package/4.api/2.composables/use-state.md +4 -4
- package/4.api/3.utils/$fetch.md +5 -5
- package/4.api/3.utils/abort-navigation.md +1 -1
- package/4.api/3.utils/add-route-middleware.md +2 -2
- package/4.api/3.utils/call-once.md +3 -3
- package/4.api/3.utils/clear-error.md +2 -2
- package/4.api/3.utils/clear-nuxt-data.md +1 -1
- package/4.api/3.utils/clear-nuxt-state.md +2 -2
- package/4.api/3.utils/create-error.md +19 -1
- package/4.api/3.utils/define-nuxt-plugin.md +2 -2
- package/4.api/3.utils/define-nuxt-route-middleware.md +3 -3
- package/4.api/3.utils/define-page-meta.md +12 -12
- package/4.api/3.utils/define-route-rules.md +4 -4
- package/4.api/3.utils/define-use-async-data-addon.md +57 -0
- package/4.api/3.utils/define-use-fetch-addon.md +168 -0
- package/4.api/3.utils/navigate-to.md +6 -2
- package/4.api/3.utils/prefetch-components.md +1 -1
- package/4.api/3.utils/preload-route-components.md +2 -2
- package/4.api/3.utils/prerender-routes.md +3 -3
- package/4.api/3.utils/refresh-cookie.md +1 -1
- package/4.api/3.utils/refresh-nuxt-data.md +3 -3
- package/4.api/3.utils/reload-nuxt-app.md +1 -1
- package/4.api/3.utils/set-page-layout.md +1 -1
- package/4.api/3.utils/set-response-status.md +2 -2
- package/4.api/3.utils/show-error.md +3 -3
- package/4.api/3.utils/update-app-config.md +2 -2
- package/4.api/4.commands/README.md +9 -0
- package/4.api/5.kit/1.modules.md +3 -3
- package/4.api/5.kit/10.runtime-config.md +1 -1
- package/4.api/5.kit/10.templates.md +42 -0
- package/4.api/5.kit/12.nitro.md +59 -18
- package/4.api/5.kit/14.logging.md +56 -2
- package/4.api/5.kit/15.builder.md +1 -1
- package/4.api/5.kit/18.dependencies.md +90 -0
- package/4.api/5.kit/2.programmatic.md +78 -1
- package/4.api/5.kit/3.compatibility.md +2 -2
- package/4.api/5.kit/4.autoimports.md +13 -13
- package/4.api/5.kit/5.components.md +3 -3
- package/4.api/5.kit/6.context.md +2 -2
- package/4.api/5.kit/7.pages.md +35 -4
- package/4.api/5.kit/8.layout.md +1 -1
- package/4.api/6.advanced/1.hooks.md +6 -3
- package/4.api/6.nuxt-config.md +44 -21
- package/4.api/index.md +7 -7
- package/5.community/2.getting-help.md +1 -1
- package/5.community/3.reporting-bugs.md +1 -1
- package/5.community/4.contribution.md +14 -12
- package/5.community/5.framework-contribution.md +4 -4
- package/5.community/6.roadmap.md +6 -6
- package/6.bridge/1.overview.md +12 -12
- package/6.bridge/2.typescript.md +1 -1
- package/6.bridge/3.bridge-composition-api.md +6 -6
- package/6.bridge/4.plugins-and-middleware.md +4 -4
- package/6.bridge/5.nuxt3-compatible-api.md +9 -9
- package/6.bridge/6.meta.md +5 -5
- package/6.bridge/7.runtime-config.md +1 -1
- package/6.bridge/8.nitro.md +1 -1
- package/6.bridge/9.vite.md +1 -1
- package/7.migration/1.overview.md +2 -2
- package/7.migration/10.bundling.md +1 -1
- package/7.migration/11.server.md +3 -3
- package/7.migration/2.configuration.md +6 -6
- package/7.migration/20.module-authors.md +7 -7
- package/7.migration/3.auto-imports.md +3 -3
- package/7.migration/4.meta.md +4 -4
- package/7.migration/5.plugins-and-middleware.md +3 -3
- package/7.migration/6.pages-and-layouts.md +13 -13
- package/7.migration/7.component-options.md +15 -15
- package/7.migration/8.runtime-config.md +4 -4
- package/README.md +1 -1
- package/errors/e8007.md +28 -0
- package/package.json +2 -2
- package/4.api/4.commands/.navigation.yml +0 -3
- package/4.api/4.commands/add.md +0 -112
- package/4.api/4.commands/analyze.md +0 -42
- package/4.api/4.commands/build-module.md +0 -42
- package/4.api/4.commands/build.md +0 -48
- package/4.api/4.commands/cleanup.md +0 -38
- package/4.api/4.commands/dev.md +0 -61
- package/4.api/4.commands/devtools.md +0 -38
- package/4.api/4.commands/generate.md +0 -43
- package/4.api/4.commands/info.md +0 -33
- package/4.api/4.commands/init.md +0 -50
- package/4.api/4.commands/module.md +0 -84
- package/4.api/4.commands/prepare.md +0 -41
- package/4.api/4.commands/preview.md +0 -44
- package/4.api/4.commands/test.md +0 -40
- package/4.api/4.commands/typecheck.md +0 -44
- package/4.api/4.commands/upgrade.md +0 -37
|
@@ -3,7 +3,7 @@ title: 'Lifecycle Hooks'
|
|
|
3
3
|
description: Nuxt provides a powerful hooking system to expand almost every aspect using hooks.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
:read-more{to="/docs/
|
|
6
|
+
:read-more{to="/docs/guide/going-further/hooks"}
|
|
7
7
|
|
|
8
8
|
## App Hooks (Runtime)
|
|
9
9
|
|
|
@@ -30,7 +30,7 @@ Check the [app source code](https://github.com/nuxt/nuxt/blob/main/packages/nuxt
|
|
|
30
30
|
| `page:loading:end` | - | Client | Called after `page:finish` |
|
|
31
31
|
| `page:transition:finish` | `pageComponent?` | Client | After page transition [onAfterLeave](https://vuejs.org/guide/built-ins/transition#javascript-hooks) event. |
|
|
32
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/
|
|
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). The `transition` argument is a [`ViewTransition`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransition) object with a `types` property ([`ViewTransitionTypeSet`](https://developer.mozilla.org/en-US/docs/Web/API/ViewTransitionTypeSet)) that can be read or modified. |
|
|
34
34
|
|
|
35
35
|
## Nuxt Hooks (Build Time)
|
|
36
36
|
|
|
@@ -44,9 +44,11 @@ Check the [schema source code](https://github.com/nuxt/nuxt/blob/main/packages/s
|
|
|
44
44
|
| `restart` | `{ hard?: boolean }` | To be called to restart the current Nuxt instance. |
|
|
45
45
|
| `modules:before` | - | Called during Nuxt initialization, before installing user modules. |
|
|
46
46
|
| `modules:done` | - | Called during Nuxt initialization, after installing user modules. |
|
|
47
|
+
| `module:before` | `module` | Called immediately before each individual module is set up. |
|
|
48
|
+
| `module:done` | `module` | Called immediately after each individual module has been set up, including how long it took. |
|
|
47
49
|
| `app:resolve` | `app` | Called after resolving the `app` instance. |
|
|
48
50
|
| `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/
|
|
51
|
+
| `app:templatesGenerated` | `app` | Called after templates are compiled into the [virtual file system](/docs/directory-structure/nuxt) (vfs). |
|
|
50
52
|
| `build:before` | - | Called before Nuxt bundle builder. |
|
|
51
53
|
| `build:done` | - | Called after Nuxt bundle builder is complete. |
|
|
52
54
|
| `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. |
|
|
@@ -55,6 +57,7 @@ Check the [schema source code](https://github.com/nuxt/nuxt/blob/main/packages/s
|
|
|
55
57
|
| `pages:extend` | `pages` | Called after page routes are scanned from the file system. |
|
|
56
58
|
| `pages:resolved` | `pages` | Called after page routes have been augmented with scanned metadata. |
|
|
57
59
|
| `pages:routerOptions` | `{ files: Array<{ path: string, optional?: boolean }> }` | Called when resolving `router.options` files. Later items in the array override earlier ones. |
|
|
60
|
+
| `server:routes` | `routes`, `context` | Called when Nuxt needs the full set of route handlers the server will serve, so that it can type `$fetch` and `useFetch` against them. |
|
|
58
61
|
| `server:devHandler` | `handler` | Called when the dev middleware is being registered on the Nitro dev server. |
|
|
59
62
|
| `imports:sources` | `presets` | Called at setup allowing modules to extend sources. |
|
|
60
63
|
| `imports:extend` | `imports` | Called at setup allowing modules to extend imports. |
|
package/4.api/6.nuxt-config.md
CHANGED
|
@@ -116,13 +116,11 @@ NUXT_APP_BASE_URL=./ npm run generate
|
|
|
116
116
|
```
|
|
117
117
|
|
|
118
118
|
```ts
|
|
119
|
-
// Option 2:
|
|
119
|
+
// Option 2: Runtime config
|
|
120
120
|
export default defineNuxtConfig({
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
baseURL: './',
|
|
125
|
-
},
|
|
121
|
+
runtimeConfig: {
|
|
122
|
+
app: {
|
|
123
|
+
baseURL: './',
|
|
126
124
|
},
|
|
127
125
|
},
|
|
128
126
|
})
|
|
@@ -329,13 +327,13 @@ Customize Nuxt Teleport element tag.
|
|
|
329
327
|
|
|
330
328
|
Default values for view transitions.
|
|
331
329
|
|
|
332
|
-
This only has an effect when **experimental** support for View Transitions is [enabled in your nuxt.config file](/docs/
|
|
330
|
+
This only has an effect when **experimental** support for View Transitions is [enabled in your nuxt.config file](/docs/getting-started/transitions#view-transitions-api-experimental).
|
|
333
331
|
This can be overridden with `definePageMeta` on an individual page.
|
|
334
332
|
|
|
335
333
|
- **Type**: `boolean`
|
|
336
334
|
- **Default:** `false`
|
|
337
335
|
|
|
338
|
-
**See**: [Nuxt View Transition API docs](/docs/
|
|
336
|
+
**See**: [Nuxt View Transition API docs](/docs/getting-started/transitions#view-transitions-api-experimental)
|
|
339
337
|
|
|
340
338
|
## appConfig
|
|
341
339
|
|
|
@@ -528,7 +526,7 @@ Any components in the directories configured here can be used throughout your pa
|
|
|
528
526
|
}
|
|
529
527
|
```
|
|
530
528
|
|
|
531
|
-
**See**: [`app/components/` directory documentation](/docs/
|
|
529
|
+
**See**: [`app/components/` directory documentation](/docs/directory-structure/app/components)
|
|
532
530
|
|
|
533
531
|
## css
|
|
534
532
|
|
|
@@ -742,7 +740,7 @@ Configure shared esbuild options used within Nuxt and passed to other builders,
|
|
|
742
740
|
|
|
743
741
|
## experimental
|
|
744
742
|
|
|
745
|
-
::read-more{to="/docs/
|
|
743
|
+
::read-more{to="/docs/guide/going-further/experimental-features"}
|
|
746
744
|
Learn more about Nuxt's experimental features.
|
|
747
745
|
::
|
|
748
746
|
|
|
@@ -776,13 +774,13 @@ The extensions that should be resolved by the Nuxt resolver.
|
|
|
776
774
|
|
|
777
775
|
## features
|
|
778
776
|
|
|
779
|
-
::read-more{to="/docs/
|
|
777
|
+
::read-more{to="/docs/guide/going-further/features#features"}
|
|
780
778
|
Learn more about Nuxt's opt-in features.
|
|
781
779
|
::
|
|
782
780
|
|
|
783
781
|
## future
|
|
784
782
|
|
|
785
|
-
::read-more{to="/docs/
|
|
783
|
+
::read-more{to="/docs/guide/going-further/features#features"}
|
|
786
784
|
Learn more about opting-in to new features that will become default in a future (possibly major) version of the framework.
|
|
787
785
|
::
|
|
788
786
|
|
|
@@ -859,7 +857,7 @@ Any file in `app/pages/`, `app/layouts/`, `app/middleware/`, and `public/` direc
|
|
|
859
857
|
|
|
860
858
|
Configure how Nuxt auto-imports composables into your application.
|
|
861
859
|
|
|
862
|
-
**See**: [Nuxt documentation](/docs/
|
|
860
|
+
**See**: [Nuxt documentation](/docs/directory-structure/app/composables)
|
|
863
861
|
|
|
864
862
|
### `dirs`
|
|
865
863
|
|
|
@@ -1039,7 +1037,7 @@ Functions to inject a key for.
|
|
|
1039
1037
|
As long as the number of arguments passed to the function is less than `argumentLength`, an additional magic string will be injected as the last argument. This key is stable between SSR and client-side hydration. You will need to take steps to handle this additional key.
|
|
1040
1038
|
The key is unique based on the location of the function being invoked within the file.
|
|
1041
1039
|
|
|
1042
|
-
::read-more{to="/docs/
|
|
1040
|
+
::read-more{to="/docs/guide/modules/recipes-basics#add-keyed-functions"}
|
|
1043
1041
|
Learn more about keyed functions.
|
|
1044
1042
|
::
|
|
1045
1043
|
|
|
@@ -1181,7 +1179,7 @@ and these plugins do not need to be listed in `nuxt.config` unless you
|
|
|
1181
1179
|
need to customize their order. All plugins are deduplicated by their src path.
|
|
1182
1180
|
::
|
|
1183
1181
|
|
|
1184
|
-
**See**: [`app/plugins/` directory documentation](/docs/
|
|
1182
|
+
**See**: [`app/plugins/` directory documentation](/docs/directory-structure/app/plugins)
|
|
1185
1183
|
|
|
1186
1184
|
**Example**:
|
|
1187
1185
|
```ts
|
|
@@ -1317,6 +1315,8 @@ Specify the server builder to use for bundling the server part of your applicati
|
|
|
1317
1315
|
|
|
1318
1316
|
By default, Nuxt uses `@nuxt/nitro-server`, which provides standalone Nitro integration. This architecture allows for different Nitro integration patterns, such as using Nitro as a Vite plugin (with the Vite Environment API).
|
|
1319
1317
|
|
|
1318
|
+
`"nitro"` and `"vite"` are shorthands for `@nuxt/nitro-server` and `@nuxt/vite-server`. The latter is experimental and implemented with Vite alone: with `ssr: false` it produces a static SPA, and with SSR enabled it builds a server from the Nuxt SSR renderer whose entry exports a web-standard `{ fetch }` (`.output/server/index.mjs` serves the static output in front of it, and `nuxt preview` runs it). Every dependency is bundled into that output, so it deploys without `node_modules`. `nuxt generate` crawls that server at the end of the build and writes a static `.output/public`. It ships no server runtime, so server routes, route rules other than `prerender`, inlined styles and server components are unavailable, and modules that need a server will not work.
|
|
1319
|
+
|
|
1320
1320
|
- **Type**: `string | { bundle: (nuxt: Nuxt) => Promise<void> }`
|
|
1321
1321
|
- **Default:** `"@nuxt/nitro-server"`
|
|
1322
1322
|
|
|
@@ -1342,7 +1342,7 @@ Each handler accepts the following options:
|
|
|
1342
1342
|
|
|
1343
1343
|
- **Type**: `array`
|
|
1344
1344
|
|
|
1345
|
-
**See**: [`server/` directory documentation](/docs/
|
|
1345
|
+
**See**: [`server/` directory documentation](/docs/directory-structure/server)
|
|
1346
1346
|
|
|
1347
1347
|
::callout
|
|
1348
1348
|
**Note**: Files from `server/api`, `server/middleware` and `server/routes` will be automatically registered by Nuxt.
|
|
@@ -1499,6 +1499,12 @@ You can use `github:`, `gitlab:`, `bitbucket:` or `https://` to extend from a re
|
|
|
1499
1499
|
|
|
1500
1500
|
Configuration for Nuxt's TypeScript integration.
|
|
1501
1501
|
|
|
1502
|
+
### `appTsConfig`
|
|
1503
|
+
|
|
1504
|
+
You can extend the generated `.nuxt/tsconfig.app.json` (and legacy `.nuxt/tsconfig.json`) TypeScript configuration using this option. Options set here take precedence over `tsConfig`.
|
|
1505
|
+
|
|
1506
|
+
**See**: [tsconfig.json information](/docs/directory-structure/tsconfig)
|
|
1507
|
+
|
|
1502
1508
|
### `builder`
|
|
1503
1509
|
|
|
1504
1510
|
Which builder types to include for your project.
|
|
@@ -1547,13 +1553,19 @@ Include parent workspace in the Nuxt project. Mostly useful for themes and modul
|
|
|
1547
1553
|
|
|
1548
1554
|
You can extend the generated `.nuxt/tsconfig.node.json` TypeScript configuration using this option.
|
|
1549
1555
|
|
|
1550
|
-
**See**: [tsconfig.json information](/docs/
|
|
1556
|
+
**See**: [tsconfig.json information](/docs/directory-structure/tsconfig)
|
|
1557
|
+
|
|
1558
|
+
### `serverTsConfig`
|
|
1559
|
+
|
|
1560
|
+
You can extend the generated `.nuxt/tsconfig.server.json` TypeScript configuration using this option. Options set here take precedence over `tsConfig`.
|
|
1561
|
+
|
|
1562
|
+
**See**: [tsconfig.json information](/docs/directory-structure/tsconfig)
|
|
1551
1563
|
|
|
1552
1564
|
### `sharedTsConfig`
|
|
1553
1565
|
|
|
1554
1566
|
You can extend the generated `.nuxt/tsconfig.shared.json` TypeScript configuration using this option.
|
|
1555
1567
|
|
|
1556
|
-
**See**: [tsconfig.json information](/docs/
|
|
1568
|
+
**See**: [tsconfig.json information](/docs/directory-structure/tsconfig)
|
|
1557
1569
|
|
|
1558
1570
|
### `shim`
|
|
1559
1571
|
|
|
@@ -1576,9 +1588,9 @@ TypeScript comes with certain checks to give you more safety and analysis of you
|
|
|
1576
1588
|
|
|
1577
1589
|
### `tsConfig`
|
|
1578
1590
|
|
|
1579
|
-
You can extend the generated `.nuxt/tsconfig.app.json`
|
|
1591
|
+
You can extend the generated tsconfig files with shared options using this option. `compilerOptions` apply to all generated tsconfigs (`.nuxt/tsconfig.app.json`, `.nuxt/tsconfig.server.json`, `.nuxt/tsconfig.node.json` and `.nuxt/tsconfig.shared.json`), while `include`, `exclude` and `vueCompilerOptions` apply only to `.nuxt/tsconfig.app.json` (and the legacy `.nuxt/tsconfig.json`). Two groups of `compilerOptions` are exceptions: DOM- and Vue-specific options (such as `lib`, `jsx` and `jsxImportSource`) apply only to `.nuxt/tsconfig.app.json`, and `types`, `paths` and `noEmit` are managed by Nuxt per context, so they cannot be set globally for the `node`, `shared` and `server` tsconfigs. Use `appTsConfig`, `serverTsConfig`, `nodeTsConfig` or `sharedTsConfig` for context-specific overrides; they take precedence over this option.
|
|
1580
1592
|
|
|
1581
|
-
**See**: [tsconfig.json information](/docs/
|
|
1593
|
+
**See**: [tsconfig.json information](/docs/directory-structure/tsconfig)
|
|
1582
1594
|
|
|
1583
1595
|
### `typeCheck`
|
|
1584
1596
|
|
|
@@ -1589,7 +1601,18 @@ If set to true, this will type check in development. You can restrict this to bu
|
|
|
1589
1601
|
- **Type**: `boolean`
|
|
1590
1602
|
- **Default:** `false`
|
|
1591
1603
|
|
|
1592
|
-
**See**: [Nuxt TypeScript docs](/docs/
|
|
1604
|
+
**See**: [Nuxt TypeScript docs](/docs/guide/concepts/typescript)
|
|
1605
|
+
|
|
1606
|
+
## typesDir
|
|
1607
|
+
|
|
1608
|
+
Define the directory where generated types and `tsconfig.json` files will be placed.
|
|
1609
|
+
|
|
1610
|
+
This defaults to your `buildDir`, and is separate from it so that the configurations referenced by your project `tsconfig.json` stay in place even when Nuxt builds elsewhere (as it does when building a project that has already been run in development).
|
|
1611
|
+
|
|
1612
|
+
If a relative path is specified, it will be relative to your `rootDir`.
|
|
1613
|
+
|
|
1614
|
+
- **Type**: `string`
|
|
1615
|
+
- **Default:** `"/<rootDir>/.nuxt"`
|
|
1593
1616
|
|
|
1594
1617
|
## unhead
|
|
1595
1618
|
|
package/4.api/index.md
CHANGED
|
@@ -7,25 +7,25 @@ surround: false
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
::card-group
|
|
10
|
-
::card{icon="i-lucide-box" title="Components" to="/docs/
|
|
10
|
+
::card{icon="i-lucide-box" title="Components" to="/docs/api/components/client-only"}
|
|
11
11
|
Explore Nuxt built-in components for pages, layouts, head, and more.
|
|
12
12
|
::
|
|
13
|
-
::card{icon="i-lucide-arrow-left-right" title="Composables" to="/docs/
|
|
13
|
+
::card{icon="i-lucide-arrow-left-right" title="Composables" to="/docs/api/composables/use-app-config"}
|
|
14
14
|
Discover Nuxt composable functions for data-fetching, head management and more.
|
|
15
15
|
::
|
|
16
|
-
::card{icon="i-lucide-square-function" title="Utils" to="/docs/
|
|
16
|
+
::card{icon="i-lucide-square-function" title="Utils" to="/docs/api/utils/dollarfetch"}
|
|
17
17
|
Learn about Nuxt utility functions for navigation, error handling and more.
|
|
18
18
|
::
|
|
19
|
-
::card{icon="i-lucide-square-terminal" title="Commands" to="/docs/
|
|
19
|
+
::card{icon="i-lucide-square-terminal" title="Commands" to="/docs/api/commands/add"}
|
|
20
20
|
List of Nuxt CLI commands to init, analyze, build, and preview your application.
|
|
21
21
|
::
|
|
22
|
-
::card{icon="i-lucide-package" title="Nuxt Kit" to="/docs/
|
|
22
|
+
::card{icon="i-lucide-package" title="Nuxt Kit" to="/docs/api/kit/modules"}
|
|
23
23
|
Understand Nuxt Kit utilities to create modules and control Nuxt.
|
|
24
24
|
::
|
|
25
|
-
::card{icon="i-lucide-brain" title="Advanced" to="/docs/
|
|
25
|
+
::card{icon="i-lucide-brain" title="Advanced" to="/docs/api/advanced/hooks"}
|
|
26
26
|
Go deep in Nuxt internals with Nuxt lifecycle hooks.
|
|
27
27
|
::
|
|
28
|
-
::card{icon="i-lucide-cog" title="Nuxt Configuration" to="/docs/
|
|
28
|
+
::card{icon="i-lucide-cog" title="Nuxt Configuration" to="/docs/api/nuxt-config"}
|
|
29
29
|
Explore all Nuxt configuration options to customize your application.
|
|
30
30
|
::
|
|
31
31
|
::
|
|
@@ -37,7 +37,7 @@ And finally, just ask the question! There's no need to [ask permission to ask a
|
|
|
37
37
|
|
|
38
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
39
|
|
|
40
|
-
We recommend taking a look at [how to report bugs](/docs/
|
|
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
41
|
|
|
42
42
|
## "I need professional help"
|
|
43
43
|
|
|
@@ -12,7 +12,7 @@ Here are a few key steps.
|
|
|
12
12
|
|
|
13
13
|
## Is It Really a Bug?
|
|
14
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/
|
|
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
16
|
|
|
17
17
|
## Search the Issues
|
|
18
18
|
|
|
@@ -11,7 +11,7 @@ There is a range of different ways you might be able to contribute to the Nuxt e
|
|
|
11
11
|
The Nuxt ecosystem includes many different projects and organizations:
|
|
12
12
|
|
|
13
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/
|
|
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/modules/ecosystem) to `nuxt-modules`. While these modules have individual maintainers, they are not dependent on a single person.
|
|
15
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
16
|
|
|
17
17
|
## How To Contribute
|
|
@@ -24,7 +24,7 @@ Check out the issues and discussions for the project you want to help. For examp
|
|
|
24
24
|
|
|
25
25
|
Thank you for taking the time to create an issue! ❤️
|
|
26
26
|
|
|
27
|
-
* **Reporting bugs**: Check out [our guide](/docs/
|
|
27
|
+
* **Reporting bugs**: Check out [our guide](/docs/community/reporting-bugs) for some things to do before opening an issue.
|
|
28
28
|
|
|
29
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
30
|
|
|
@@ -42,7 +42,7 @@ If you're working on a feature, then we ask that you **open a feature request is
|
|
|
42
42
|
|
|
43
43
|
For typo fixes, it's recommended to batch multiple typo fixes into one pull request to maintain a cleaner commit history.
|
|
44
44
|
|
|
45
|
-
For bigger changes to Nuxt itself, we recommend that you first [create a Nuxt module](/docs/
|
|
45
|
+
For bigger changes to Nuxt itself, we recommend that you first [create a Nuxt module](/docs/community/contribution#create-a-module) and implement the feature there. This allows for quick proof-of-concept. You can then [create an RFC](/docs/community/contribution#make-an-rfc) in the form of a discussion. As users adopt it and you gather feedback, it can then be refined and either added to Nuxt core or continue as a standalone module.
|
|
46
46
|
|
|
47
47
|
#### Commit Conventions
|
|
48
48
|
|
|
@@ -58,7 +58,7 @@ If you are working in a project with a monorepo, like `nuxt/nuxt`, ensure that y
|
|
|
58
58
|
|
|
59
59
|
If you don't know how to send a pull request, we recommend reading [the guide](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
|
|
60
60
|
|
|
61
|
-
When sending a pull request, make sure your PR's title also follows the [Commit Convention](/docs/
|
|
61
|
+
When sending a pull request, make sure your PR's title also follows the [Commit Convention](/docs/community/contribution#commit-conventions).
|
|
62
62
|
|
|
63
63
|
If your PR fixes or resolves existing issues, please make sure you mention them in the PR description.
|
|
64
64
|
|
|
@@ -100,13 +100,13 @@ Our aim is ensuring quality and maintaining the joy of collaborating and communi
|
|
|
100
100
|
|
|
101
101
|
### Create a Module
|
|
102
102
|
|
|
103
|
-
If you've built something with Nuxt that's cool, why not [extract it into a module](/docs/
|
|
103
|
+
If you've built something with Nuxt that's cool, why not [extract it into a module](/docs/guide/modules), so it can be shared with others? We have [many excellent modules already](/modules), but there's always room for more.
|
|
104
104
|
|
|
105
|
-
If you need help while building it, feel free to [check in with us](/docs/
|
|
105
|
+
If you need help while building it, feel free to [check in with us](/docs/community/getting-help).
|
|
106
106
|
|
|
107
107
|
### Make an RFC
|
|
108
108
|
|
|
109
|
-
We highly recommend [creating a module](/docs/
|
|
109
|
+
We highly recommend [creating a module](/docs/community/contribution#create-a-module) first to test out big new features and gain community adoption.
|
|
110
110
|
|
|
111
111
|
If you have done this already, or it's not appropriate to create a new module, then please start by creating a new discussion. Make sure it explains your thinking as clearly as possible. Include code examples or function signatures for new APIs. Reference existing issues or pain points with examples.
|
|
112
112
|
|
|
@@ -126,7 +126,7 @@ The following conventions are _required_ within the `nuxt/` organization and rec
|
|
|
126
126
|
|
|
127
127
|
#### Module Conventions
|
|
128
128
|
|
|
129
|
-
Modules should follow the [Nuxt module template](https://github.com/nuxt/starter/tree/module). See [module guide](/docs/
|
|
129
|
+
Modules should follow the [Nuxt module template](https://github.com/nuxt/starter/tree/module). See [module guide](/docs/guide/modules) for more information.
|
|
130
130
|
|
|
131
131
|
#### Use Core `unjs/` Libraries
|
|
132
132
|
|
|
@@ -139,7 +139,7 @@ We recommend the following libraries which are used throughout the ecosystem:
|
|
|
139
139
|
|
|
140
140
|
#### Use ESM Syntax and Default to `type: module`
|
|
141
141
|
|
|
142
|
-
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/
|
|
142
|
+
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).
|
|
143
143
|
|
|
144
144
|
#### What's Corepack
|
|
145
145
|
|
|
@@ -172,7 +172,7 @@ We recommend using [VS Code](https://code.visualstudio.com) along with the [ESLi
|
|
|
172
172
|
|
|
173
173
|
#### No Prettier
|
|
174
174
|
|
|
175
|
-
Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run `yarn lint --fix`, `pnpm lint --fix`, `bun run lint --fix`, or `deno run lint --fix` or referring the [ESLint section](/docs/
|
|
175
|
+
Since ESLint is already configured to format the code, there is no need to duplicate the functionality with Prettier. To format the code, you can run `yarn lint --fix`, `pnpm lint --fix`, `bun run lint --fix`, or `deno run lint --fix` or referring the [ESLint section](/docs/community/contribution#use-eslint) for IDE Setup.
|
|
176
176
|
|
|
177
177
|
If you have Prettier installed in your editor, we recommend you disable it when working on the project to avoid conflict.
|
|
178
178
|
|
|
@@ -256,7 +256,9 @@ Do not use backticks for names of tools, projects, or general concepts (use _Vit
|
|
|
256
256
|
|
|
257
257
|
### Links
|
|
258
258
|
|
|
259
|
-
* When linking to other documentation pages, use relative paths without the domain: `/docs/4.x/getting-started/installation`
|
|
259
|
+
* When linking to other documentation pages, use relative paths without the domain or a version segment: `/docs/getting-started/installation` rather than `/docs/4.x/getting-started/installation` or `https://nuxt.com/docs/4.x/getting-started/installation`. nuxt.com inserts the version segment of the branch the page was built from, so the same link resolves correctly on every version and docs changes can be cherry-picked between branches unchanged.
|
|
260
|
+
|
|
261
|
+
* Only write a version segment when you deliberately mean _another_ version's docs (the release table in the roadmap, for example). In that case use the full URL, `https://nuxt.com/docs/3.x/getting-started/introduction`, so the intent is obvious in review.
|
|
260
262
|
|
|
261
263
|
* When linking to external resources, link to the final URL rather than one that redirects. You can check with:
|
|
262
264
|
|
|
@@ -313,6 +315,6 @@ We aim for a tone that is friendly and professional. Write directly to the reade
|
|
|
313
315
|
|
|
314
316
|
To find the version, check `@since` in JSDoc in the source, the [release notes](https://github.com/nuxt/nuxt/releases), or the [Nuxt blog](https://nuxt.com/blog).
|
|
315
317
|
|
|
316
|
-
::read-more{to="/docs/
|
|
318
|
+
::read-more{to="/docs/community/framework-contribution#documentation-guide"}
|
|
317
319
|
Learn how to contribute to the documentation.
|
|
318
320
|
::
|
|
@@ -4,7 +4,7 @@ navigation.icon: i-lucide-github
|
|
|
4
4
|
description: Some specific points about contributions to the framework repository.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
Once you've read the [general contribution guide](/docs/
|
|
7
|
+
Once you've read the [general contribution guide](/docs/community/contribution), here are some specific points to make about contributions to the [`nuxt/nuxt`](https://github.com/nuxt/nuxt) repository.
|
|
8
8
|
|
|
9
9
|
## Monorepo Guide
|
|
10
10
|
|
|
@@ -42,7 +42,7 @@ To contribute to Nuxt, you need to set up a local environment.
|
|
|
42
42
|
git checkout -b my-new-branch
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Then, test your changes against the [playground](/docs/
|
|
45
|
+
Then, test your changes against the [playground](/docs/community/framework-contribution#playground) and [test](/docs/community/framework-contribution#testing) your changes before submitting a pull request.
|
|
46
46
|
|
|
47
47
|
### Playground
|
|
48
48
|
|
|
@@ -88,7 +88,7 @@ If there are still errors left, you must correct them manually.
|
|
|
88
88
|
If you are adding a new feature or refactoring or changing the behavior of Nuxt in any other manner, you'll likely want to document the changes. Please include any changes to the docs in the same PR. You don't have to write documentation up on the first commit (but please do so as soon as your pull request is mature enough).
|
|
89
89
|
|
|
90
90
|
::important
|
|
91
|
-
Make sure to make changes according to the [Documentation Style Guide](/docs/
|
|
91
|
+
Make sure to make changes according to the [Documentation Style Guide](/docs/community/contribution#documentation-style-guide).
|
|
92
92
|
::
|
|
93
93
|
|
|
94
94
|
### Final Checklist
|
|
@@ -100,7 +100,7 @@ When submitting your PR, there is a simple template that you have to fill out. P
|
|
|
100
100
|
If you spot an area where we can improve documentation or error messages, please do open a PR - even if it's just to fix a typo!
|
|
101
101
|
|
|
102
102
|
::important
|
|
103
|
-
Make sure to make changes according to the [Documentation Style Guide](/docs/
|
|
103
|
+
Make sure to make changes according to the [Documentation Style Guide](/docs/community/contribution#documentation-style-guide).
|
|
104
104
|
::
|
|
105
105
|
|
|
106
106
|
### Quick Edits
|
package/5.community/6.roadmap.md
CHANGED
|
@@ -41,7 +41,7 @@ In addition to the Nuxt framework, there are modules that are vital for the ecos
|
|
|
41
41
|
| Module | Status | Nuxt Support | Repository | Description |
|
|
42
42
|
|----------------------------------------|--------------|--------------|-------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
43
43
|
| Auth Utils | Planned | 4.x, 5.x | `nuxt/auth-utils` to be announced | The temporary repository [atinux/nuxt-auth-utils](https://github.com/atinux/nuxt-auth-utils) is available while awaiting its official integration into Nuxt via RFC. |
|
|
44
|
-
| [a11y](https://github.com/nuxt/a11y) | Public Alpha |
|
|
44
|
+
| [a11y](https://github.com/nuxt/a11y) | Public Alpha | 4.x, 5.x | [nuxt/a11y](https://github.com/nuxt/a11y). | Real-time accessibility feedback and automated testing in your browser during development (see [nuxt/nuxt#23255](https://github.com/nuxt/nuxt/issues/23255)). |
|
|
45
45
|
|
|
46
46
|
## Release Cycle
|
|
47
47
|
|
|
@@ -59,15 +59,15 @@ We commit to support each major version of Nuxt for a minimum of six months afte
|
|
|
59
59
|
|
|
60
60
|
The current active version of [Nuxt](https://nuxt.com) is **v4** which is available as `nuxt` on npm with the `latest` tag.
|
|
61
61
|
|
|
62
|
-
Nuxt 3
|
|
62
|
+
Nuxt 3 reached end of life on 31 July 2026 and no longer receives bug fixes or security patches. If you are still on Nuxt 3, follow the [upgrade guide](/docs/getting-started/upgrade) to move to Nuxt 4.
|
|
63
63
|
|
|
64
|
-
Each active version has its own nightly releases which are generated automatically. For more about enabling the Nuxt nightly release channel, see [the nightly release channel docs](/docs/
|
|
64
|
+
Each active version has its own nightly releases which are generated automatically. For more about enabling the Nuxt nightly release channel, see [the nightly release channel docs](/docs/guide/going-further/nightly-release-channel).
|
|
65
65
|
|
|
66
66
|
| Release | | Initial release | End Of Life | Docs |
|
|
67
67
|
|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------|----------------------------|-------------------------------------------------------------------|
|
|
68
|
-
| **5.x** (scheduled) | |
|
|
69
|
-
| **4.x** (stable) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt latest version" src="https://img.shields.io/npm/v/nuxt.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2025-07-16 | 6 months after 5.x release | [nuxt.com](/docs/4.x/getting-started/introduction)
|
|
70
|
-
| **3.x** (
|
|
68
|
+
| **5.x** (scheduled) | | Q4 2026 (estimated) | TBA | |
|
|
69
|
+
| **4.x** (stable) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt latest version" src="https://img.shields.io/npm/v/nuxt.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2025-07-16 | 6 months after 5.x release | [nuxt.com](https://nuxt.com/docs/4.x/getting-started/introduction) |
|
|
70
|
+
| **3.x** (unsupported) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 3.x version" src="https://img.shields.io/npm/v/nuxt/3x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2022-11-16 | 2026-07-31 | [nuxt.com](https://nuxt.com/docs/3.x/getting-started/introduction) |
|
|
71
71
|
| **2.x** (unsupported) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 2.x version" src="https://img.shields.io/npm/v/nuxt/2x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2018-09-21 | 2024-06-30 | [v2.nuxt.com](https://v2.nuxt.com/docs/get-started/installation/) |
|
|
72
72
|
| **1.x** (unsupported) | <a href="https://www.npmjs.com/package/nuxt?activeTab=versions"><img alt="Nuxt 1.x version" src="https://img.shields.io/npm/v/nuxt/1x.svg?logo=nuxt&label=&style=flat&colorA=18181B&colorB=28CF8D" class="not-prose h-5 w-auto" :zoom="false"></a> | 2018-01-08 | 2019-09-21 | |
|
|
73
73
|
|
package/6.bridge/1.overview.md
CHANGED
|
@@ -4,11 +4,11 @@ description: Reduce the differences with Nuxt 3 and reduce the burden of migrati
|
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
::note
|
|
7
|
-
If you're starting a fresh Nuxt 3 project, please skip this section and go to [Nuxt 3 Installation](/docs/
|
|
7
|
+
If you're starting a fresh Nuxt 3 project, please skip this section and go to [Nuxt 3 Installation](/docs/getting-started/introduction).
|
|
8
8
|
::
|
|
9
9
|
|
|
10
10
|
::warning
|
|
11
|
-
Nuxt Bridge provides identical features to Nuxt 3 ([docs](/docs/
|
|
11
|
+
Nuxt Bridge provides identical features to Nuxt 3 ([docs](/docs/guide/concepts/auto-imports)) but there are some limitations, notably that [`useAsyncData`](/docs/api/composables/use-async-data) and [`useFetch`](/docs/api/composables/use-fetch) composables are not available. Please read the rest of this page for details.
|
|
12
12
|
::
|
|
13
13
|
|
|
14
14
|
Bridge is a forward-compatibility layer that allows you to experience many of the new Nuxt 3 features by simply installing and enabling a Nuxt module.
|
|
@@ -88,7 +88,7 @@ deno add -D npm:@nuxt/bridge npm:nuxi
|
|
|
88
88
|
|
|
89
89
|
Please make sure to avoid any CommonJS syntax such as `module.exports`, `require` or `require.resolve` in your config file. It will soon be deprecated and unsupported.
|
|
90
90
|
|
|
91
|
-
You can use static `import`, dynamic `import()` and `export default` instead. Using TypeScript by renaming to [`nuxt.config.ts`](/docs/
|
|
91
|
+
You can use static `import`, dynamic `import()` and `export default` instead. Using TypeScript by renaming to [`nuxt.config.ts`](/docs/directory-structure/nuxt-config) is also possible and recommended.
|
|
92
92
|
|
|
93
93
|
```ts [nuxt.config.ts]
|
|
94
94
|
import { defineNuxtConfig } from '@nuxt/bridge'
|
|
@@ -124,22 +124,22 @@ Try running `nuxt2` once here. You will see that the application works as before
|
|
|
124
124
|
With Nuxt Bridge, the migration to Nuxt 3 can proceed in steps.
|
|
125
125
|
The below `Upgrade Steps` does not need to be done all at once.
|
|
126
126
|
|
|
127
|
-
- [TypeScript](/docs/
|
|
127
|
+
- [TypeScript](/docs/bridge/typescript)
|
|
128
128
|
|
|
129
|
-
- [Migrate Legacy Composition API](/docs/
|
|
129
|
+
- [Migrate Legacy Composition API](/docs/bridge/bridge-composition-api)
|
|
130
130
|
|
|
131
|
-
- [Plugins and Middleware](/docs/
|
|
131
|
+
- [Plugins and Middleware](/docs/bridge/plugins-and-middleware)
|
|
132
132
|
|
|
133
|
-
- [Migrate New Composition API](/docs/
|
|
133
|
+
- [Migrate New Composition API](/docs/bridge/nuxt3-compatible-api)
|
|
134
134
|
|
|
135
|
-
- [Meta Tags](/docs/
|
|
135
|
+
- [Meta Tags](/docs/bridge/meta)
|
|
136
136
|
|
|
137
|
-
- [Runtime Config](/docs/
|
|
137
|
+
- [Runtime Config](/docs/bridge/runtime-config)
|
|
138
138
|
|
|
139
|
-
- [Nitro](/docs/
|
|
139
|
+
- [Nitro](/docs/bridge/nitro)
|
|
140
140
|
|
|
141
|
-
- [Vite](/docs/
|
|
141
|
+
- [Vite](/docs/bridge/vite)
|
|
142
142
|
|
|
143
143
|
## Migrate from CommonJS to ESM
|
|
144
144
|
|
|
145
|
-
Nuxt 3 natively supports TypeScript and ECMAScript Modules. Please check [Native ES Modules](/docs/
|
|
145
|
+
Nuxt 3 natively supports TypeScript and ECMAScript Modules. Please check [Native ES Modules](/docs/guide/concepts/esm) for more info and upgrading.
|
package/6.bridge/2.typescript.md
CHANGED
|
@@ -37,7 +37,7 @@ If you are using TypeScript, you can edit your `tsconfig.json` to benefit from a
|
|
|
37
37
|
::note
|
|
38
38
|
As `.nuxt/tsconfig.json` is generated and not checked into version control, you'll need to generate that file before running your tests. Add `nuxi prepare` as a step before your tests, otherwise you'll see `TS5083: Cannot read file '~/.nuxt/tsconfig.json'`
|
|
39
39
|
|
|
40
|
-
For modern Nuxt projects, we recommend using [TypeScript project references](/docs/
|
|
40
|
+
For modern Nuxt projects, we recommend using [TypeScript project references](/docs/directory-structure/tsconfig) instead of directly extending `.nuxt/tsconfig.json`.
|
|
41
41
|
::
|
|
42
42
|
|
|
43
43
|
::note
|
|
@@ -35,9 +35,9 @@ Because some composables have been removed and don't yet have a replacement, thi
|
|
|
35
35
|
|
|
36
36
|
You don't have to immediately update your imports yet - Nuxt Bridge will automatically provide a 'shim' for most imports you currently have, to give you time to migrate to the new, Nuxt 3-compatible composables, with the following exceptions:
|
|
37
37
|
|
|
38
|
-
- `withContext` has been removed. See [below](/docs/
|
|
38
|
+
- `withContext` has been removed. See [below](/docs/bridge/nuxt3-compatible-api#usecontext-and-withcontext).
|
|
39
39
|
- `useStatic` has been removed. There is no current replacement. Feel free to raise a discussion if you have a use case for this.
|
|
40
|
-
- `reqRef` and `reqSsrRef`, which were deprecated, have now been removed entirely. Follow the instructions below regarding [ssrRef](/docs/
|
|
40
|
+
- `reqRef` and `reqSsrRef`, which were deprecated, have now been removed entirely. Follow the instructions below regarding [ssrRef](/docs/bridge/nuxt3-compatible-api#ssrref-and-shallowssrref) to replace this.
|
|
41
41
|
|
|
42
42
|
### Set `bridge.capi`
|
|
43
43
|
|
|
@@ -91,7 +91,7 @@ export default <Middleware> function (ctx) { }
|
|
|
91
91
|
|
|
92
92
|
This was a type-helper stub function that is now removed.
|
|
93
93
|
|
|
94
|
-
You may also keep using Nuxt 2-style plugins, by removing the function (as with [defineNuxtMiddleware](/docs/
|
|
94
|
+
You may also keep using Nuxt 2-style plugins, by removing the function (as with [defineNuxtMiddleware](/docs/bridge/bridge-composition-api#definenuxtmiddleware)).
|
|
95
95
|
|
|
96
96
|
Remove the `defineNuxtPlugin` wrapper:
|
|
97
97
|
|
|
@@ -113,13 +113,13 @@ export default <Plugin> function (ctx, inject) {}
|
|
|
113
113
|
While this example is valid, Nuxt 3 introduces a new defineNuxtPlugin function that has a slightly different signature.
|
|
114
114
|
::
|
|
115
115
|
|
|
116
|
-
:ReadMore{link="/docs/
|
|
116
|
+
:ReadMore{link="/docs/directory-structure/app/plugins#creating-plugins"}
|
|
117
117
|
|
|
118
118
|
### `useRouter` and `useRoute`
|
|
119
119
|
|
|
120
|
-
Nuxt Bridge provides direct replacements for these composables via [`useRouter`](/docs/
|
|
120
|
+
Nuxt Bridge provides direct replacements for these composables via [`useRouter`](/docs/api/composables/use-router) and `useRoute`.
|
|
121
121
|
|
|
122
|
-
The only key difference is that [`useRoute`](/docs/
|
|
122
|
+
The only key difference is that [`useRoute`](/docs/api/composables/use-route) no longer returns a computed property.
|
|
123
123
|
|
|
124
124
|
```diff
|
|
125
125
|
- import { useRouter, useRoute } from '@nuxtjs/composition-api'
|
|
@@ -7,7 +7,7 @@ description: 'Learn how to migrate from Nuxt 2 to Nuxt Bridge new plugins and mi
|
|
|
7
7
|
|
|
8
8
|
You can now migrate to the Nuxt 3 plugins API, which is slightly different in format from Nuxt 2.
|
|
9
9
|
|
|
10
|
-
Plugins now take only one argument (`nuxtApp`). You can find out more in [the docs](/docs/
|
|
10
|
+
Plugins now take only one argument (`nuxtApp`). You can find out more in [the docs](/docs/directory-structure/app/plugins).
|
|
11
11
|
|
|
12
12
|
```ts [app/plugins/hello.ts]
|
|
13
13
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
@@ -17,7 +17,7 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
::note
|
|
20
|
-
If you want to use the new Nuxt composables (such as [`useNuxtApp`](/docs/
|
|
20
|
+
If you want to use the new Nuxt composables (such as [`useNuxtApp`](/docs/api/composables/use-nuxt-app) or `useRuntimeConfig`) within your plugins, you will need to use the `defineNuxtPlugin` helper for those plugins.
|
|
21
21
|
::
|
|
22
22
|
|
|
23
23
|
::warning
|
|
@@ -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/
|
|
31
|
+
Middleware now take only two argument (`to`, `from`). You can find out more in [the docs](/docs/directory-structure/app/middleware).
|
|
32
32
|
|
|
33
33
|
```ts twoslash
|
|
34
34
|
export default defineNuxtRouteMiddleware((to) => {
|
|
@@ -44,7 +44,7 @@ Use of `defineNuxtRouteMiddleware` is not supported outside of the `app/middlewa
|
|
|
44
44
|
|
|
45
45
|
## definePageMeta
|
|
46
46
|
|
|
47
|
-
You can also use [`definePageMeta`](/docs/
|
|
47
|
+
You can also use [`definePageMeta`](/docs/api/utils/define-page-meta) in Nuxt Bridge.
|
|
48
48
|
|
|
49
49
|
It can be enabled with the `macros.pageMeta` option in your configuration file
|
|
50
50
|
|