@nuxt/docs 3.20.1 → 3.21.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.
- package/1.getting-started/01.introduction.md +5 -5
- package/1.getting-started/02.installation.md +4 -7
- package/1.getting-started/03.configuration.md +32 -32
- package/1.getting-started/04.views.md +10 -8
- package/1.getting-started/05.assets.md +8 -8
- package/1.getting-started/06.styling.md +24 -18
- package/1.getting-started/07.routing.md +11 -11
- package/1.getting-started/08.seo-meta.md +10 -6
- package/1.getting-started/09.transitions.md +12 -12
- package/1.getting-started/10.data-fetching.md +18 -18
- package/1.getting-started/11.state-management.md +7 -7
- package/1.getting-started/12.error-handling.md +28 -22
- package/1.getting-started/13.server.md +9 -9
- package/1.getting-started/14.layers.md +52 -18
- package/1.getting-started/15.prerendering.md +10 -4
- package/1.getting-started/16.deployment.md +3 -2
- package/1.getting-started/17.testing.md +18 -8
- package/1.getting-started/18.upgrade.md +111 -60
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.nuxt.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/0.output.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.assets.md +3 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.components.md +13 -9
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.composables.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.content.md +2 -2
- package/2.directory-structure/1.layers.md +87 -0
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.layouts.md +37 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.middleware.md +8 -8
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.modules.md +10 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.node_modules.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.pages.md +43 -22
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.plugins.md +6 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.public.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.server.md +29 -9
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.shared.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/1.utils.md +5 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.env.md +4 -4
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtignore.md +2 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/2.nuxtrc.md +6 -3
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.app-config.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.app.md +5 -5
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.error.md +10 -8
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.nuxt-config.md +2 -2
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.package.md +1 -1
- package/{2.guide/1.directory-structure → 2.directory-structure}/3.tsconfig.md +3 -2
- package/2.directory-structure/index.md +65 -0
- package/3.guide/0.index.md +28 -0
- package/{2.guide/2.concepts/3.rendering.md → 3.guide/1.concepts/1.rendering.md} +8 -33
- package/{2.guide/2.concepts/2.vuejs-development.md → 3.guide/1.concepts/10.vuejs-development.md} +11 -10
- package/{2.guide/2.concepts/10.nuxt-lifecycle.md → 3.guide/1.concepts/2.nuxt-lifecycle.md} +34 -27
- package/{2.guide/2.concepts/1.auto-imports.md → 3.guide/1.concepts/3.auto-imports.md} +10 -10
- package/{2.guide/2.concepts → 3.guide/1.concepts}/4.server-engine.md +3 -3
- package/{2.guide/2.concepts → 3.guide/1.concepts}/5.modules.md +15 -2
- package/{2.guide/2.concepts → 3.guide/1.concepts}/7.esm.md +5 -4
- package/{2.guide/2.concepts → 3.guide/1.concepts}/8.typescript.md +11 -17
- package/{2.guide/2.concepts → 3.guide/1.concepts}/9.code-style.md +1 -1
- package/{2.guide/5.best-practices → 3.guide/2.best-practices}/hydration.md +1 -1
- package/{2.guide/5.best-practices → 3.guide/2.best-practices}/performance.md +5 -5
- package/3.guide/3.ai/.navigation.yml +3 -0
- package/3.guide/3.ai/1.mcp.md +277 -0
- package/3.guide/3.ai/2.llms-txt.md +65 -0
- package/3.guide/4.modules/.navigation.yml +3 -0
- package/3.guide/4.modules/1.getting-started.md +103 -0
- package/3.guide/4.modules/2.module-anatomy.md +138 -0
- package/3.guide/4.modules/3.recipes-basics.md +330 -0
- package/3.guide/4.modules/4.recipes-advanced.md +243 -0
- package/3.guide/4.modules/5.testing.md +76 -0
- package/3.guide/4.modules/6.best-practices.md +104 -0
- package/3.guide/4.modules/7.ecosystem.md +32 -0
- package/3.guide/4.modules/index.md +36 -0
- package/{2.guide/4.recipes → 3.guide/5.recipes}/1.custom-routing.md +4 -4
- package/{2.guide/4.recipes → 3.guide/5.recipes}/2.vite-plugin.md +5 -1
- package/{2.guide/4.recipes → 3.guide/5.recipes}/3.custom-usefetch.md +3 -3
- package/{2.guide/4.recipes → 3.guide/5.recipes}/4.sessions-and-authentication.md +2 -2
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.events.md +3 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.experimental-features.md +212 -87
- package/3.guide/6.going-further/1.features.md +108 -0
- package/{2.guide/3.going-further → 3.guide/6.going-further}/1.internals.md +5 -4
- package/{2.guide/3.going-further → 3.guide/6.going-further}/10.runtime-config.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/11.nightly-release-channel.md +1 -1
- package/{2.guide/3.going-further → 3.guide/6.going-further}/2.hooks.md +7 -7
- package/{2.guide/3.going-further → 3.guide/6.going-further}/4.kit.md +3 -3
- package/{2.guide/3.going-further → 3.guide/6.going-further}/6.nuxt-app.md +6 -6
- package/{2.guide/3.going-further → 3.guide/6.going-further}/7.layers.md +40 -14
- package/{2.guide/3.going-further → 3.guide/6.going-further}/9.debugging.md +3 -2
- package/{3.api → 4.api}/1.components/1.nuxt-client-fallback.md +5 -1
- package/{3.api → 4.api}/1.components/10.nuxt-picture.md +1 -1
- package/{3.api → 4.api}/1.components/11.teleports.md +2 -2
- package/{3.api → 4.api}/1.components/12.nuxt-route-announcer.md +1 -3
- package/{3.api → 4.api}/1.components/13.nuxt-time.md +0 -2
- package/{3.api → 4.api}/1.components/2.nuxt-page.md +4 -4
- package/{3.api → 4.api}/1.components/3.nuxt-layout.md +7 -7
- package/{3.api → 4.api}/1.components/4.nuxt-link.md +13 -13
- package/{3.api → 4.api}/1.components/5.nuxt-loading-indicator.md +2 -2
- package/{3.api → 4.api}/1.components/6.nuxt-error-boundary.md +2 -2
- package/{3.api → 4.api}/1.components/7.nuxt-welcome.md +2 -2
- package/{3.api → 4.api}/1.components/8.nuxt-island.md +9 -2
- package/{3.api → 4.api}/2.composables/use-app-config.md +1 -1
- package/{3.api → 4.api}/2.composables/use-async-data.md +5 -5
- package/4.api/2.composables/use-cookie.md +183 -0
- package/{3.api → 4.api}/2.composables/use-error.md +3 -3
- package/{3.api → 4.api}/2.composables/use-fetch.md +37 -37
- package/{3.api → 4.api}/2.composables/use-head-safe.md +1 -1
- package/{3.api → 4.api}/2.composables/use-head.md +22 -7
- package/{3.api → 4.api}/2.composables/use-lazy-async-data.md +1 -1
- package/{3.api → 4.api}/2.composables/use-lazy-fetch.md +9 -9
- package/{3.api → 4.api}/2.composables/use-nuxt-app.md +11 -9
- package/{3.api → 4.api}/2.composables/use-response-header.md +1 -1
- package/{3.api → 4.api}/2.composables/use-route-announcer.md +0 -2
- package/{3.api → 4.api}/2.composables/use-route.md +2 -2
- package/4.api/2.composables/use-router.md +94 -0
- package/{3.api → 4.api}/2.composables/use-runtime-config.md +5 -5
- package/{3.api → 4.api}/2.composables/use-seo-meta.md +2 -2
- package/{3.api → 4.api}/2.composables/use-server-seo-meta.md +2 -2
- package/{3.api → 4.api}/2.composables/use-state.md +12 -2
- package/{3.api → 4.api}/3.utils/$fetch.md +2 -2
- package/{3.api → 4.api}/3.utils/abort-navigation.md +3 -3
- package/{3.api → 4.api}/3.utils/add-route-middleware.md +1 -1
- package/{3.api → 4.api}/3.utils/call-once.md +2 -4
- package/{3.api → 4.api}/3.utils/clear-error.md +1 -1
- package/{3.api → 4.api}/3.utils/create-error.md +7 -7
- package/{3.api → 4.api}/3.utils/define-lazy-hydration-component.md +5 -5
- package/{3.api → 4.api}/3.utils/define-nuxt-component.md +1 -1
- package/{3.api → 4.api}/3.utils/define-nuxt-plugin.md +12 -12
- package/{3.api → 4.api}/3.utils/define-nuxt-route-middleware.md +3 -3
- package/{3.api → 4.api}/3.utils/define-page-meta.md +23 -16
- package/{3.api → 4.api}/3.utils/define-route-rules.md +2 -2
- package/{3.api → 4.api}/3.utils/navigate-to.md +14 -14
- package/{3.api → 4.api}/3.utils/on-before-route-leave.md +1 -1
- package/{3.api → 4.api}/3.utils/on-before-route-update.md +1 -1
- package/{3.api → 4.api}/3.utils/preload-route-components.md +2 -2
- package/{3.api → 4.api}/3.utils/refresh-cookie.md +0 -2
- package/{3.api → 4.api}/3.utils/refresh-nuxt-data.md +1 -1
- package/{3.api → 4.api}/3.utils/reload-nuxt-app.md +1 -1
- package/{3.api → 4.api}/3.utils/set-page-layout.md +36 -0
- package/{3.api → 4.api}/3.utils/set-response-status.md +3 -3
- package/{3.api → 4.api}/3.utils/show-error.md +4 -4
- package/{3.api → 4.api}/3.utils/update-app-config.md +2 -2
- package/{3.api → 4.api}/4.commands/add.md +11 -11
- package/4.api/4.commands/analyze.md +42 -0
- package/4.api/4.commands/build-module.md +42 -0
- package/4.api/4.commands/build.md +47 -0
- package/{3.api → 4.api}/4.commands/cleanup.md +6 -6
- package/4.api/4.commands/dev.md +60 -0
- package/{3.api → 4.api}/4.commands/devtools.md +7 -7
- package/4.api/4.commands/generate.md +42 -0
- package/4.api/4.commands/info.md +33 -0
- package/4.api/4.commands/init.md +50 -0
- package/4.api/4.commands/module.md +84 -0
- package/4.api/4.commands/prepare.md +41 -0
- package/4.api/4.commands/preview.md +44 -0
- package/4.api/4.commands/test.md +40 -0
- package/4.api/4.commands/typecheck.md +44 -0
- package/4.api/4.commands/upgrade.md +37 -0
- package/{3.api → 4.api}/5.kit/1.modules.md +31 -18
- package/{3.api → 4.api}/5.kit/10.templates.md +23 -23
- package/{3.api → 4.api}/5.kit/11.nitro.md +36 -36
- package/{3.api → 4.api}/5.kit/12.resolving.md +2 -2
- package/{3.api → 4.api}/5.kit/14.builder.md +35 -23
- package/{3.api → 4.api}/5.kit/16.layers.md +16 -16
- package/{3.api → 4.api}/5.kit/2.programmatic.md +2 -2
- package/{3.api → 4.api}/5.kit/3.compatibility.md +2 -2
- package/{3.api → 4.api}/5.kit/4.autoimports.md +18 -18
- package/4.api/5.kit/5.components.md +146 -0
- package/{3.api → 4.api}/5.kit/6.context.md +1 -1
- package/{3.api → 4.api}/5.kit/8.layout.md +1 -1
- package/4.api/6.advanced/1.hooks.md +105 -0
- package/{3.api → 4.api}/index.md +7 -7
- package/5.community/4.contribution.md +10 -10
- package/5.community/5.framework-contribution.md +9 -9
- package/5.community/6.roadmap.md +25 -25
- package/5.community/7.changelog.md +20 -0
- package/6.bridge/1.overview.md +9 -1
- package/6.bridge/3.bridge-composition-api.md +2 -2
- package/6.bridge/4.plugins-and-middleware.md +4 -4
- package/6.bridge/5.nuxt3-compatible-api.md +1 -1
- package/6.bridge/8.nitro.md +4 -0
- 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 +3 -3
- package/7.migration/3.auto-imports.md +1 -1
- package/7.migration/4.meta.md +1 -1
- package/7.migration/5.plugins-and-middleware.md +3 -3
- package/7.migration/6.pages-and-layouts.md +9 -9
- package/7.migration/7.component-options.md +6 -6
- package/7.migration/8.runtime-config.md +1 -1
- package/package.json +1 -1
- package/2.guide/0.index.md +0 -25
- package/2.guide/3.going-further/1.features.md +0 -103
- package/2.guide/3.going-further/3.modules.md +0 -901
- package/3.api/2.composables/use-cookie.md +0 -183
- package/3.api/2.composables/use-router.md +0 -94
- package/3.api/4.commands/analyze.md +0 -42
- package/3.api/4.commands/build-module.md +0 -42
- package/3.api/4.commands/build.md +0 -47
- package/3.api/4.commands/dev.md +0 -60
- package/3.api/4.commands/generate.md +0 -42
- package/3.api/4.commands/info.md +0 -33
- package/3.api/4.commands/init.md +0 -50
- package/3.api/4.commands/module.md +0 -84
- package/3.api/4.commands/prepare.md +0 -41
- package/3.api/4.commands/preview.md +0 -44
- package/3.api/4.commands/test.md +0 -40
- package/3.api/4.commands/typecheck.md +0 -44
- package/3.api/4.commands/upgrade.md +0 -37
- package/3.api/5.kit/5.components.md +0 -146
- package/3.api/6.advanced/1.hooks.md +0 -105
- /package/{2.guide/1.directory-structure → 2.directory-structure}/.navigation.yml +0 -0
- /package/{2.guide/1.directory-structure → 2.directory-structure}/2.gitignore.md +0 -0
- /package/{2.guide → 3.guide}/.navigation.yml +0 -0
- /package/{2.guide/2.concepts → 3.guide/1.concepts}/.navigation.yml +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/.navigation.yml +0 -0
- /package/{2.guide/5.best-practices → 3.guide/2.best-practices}/plugins.md +0 -0
- /package/{2.guide/4.recipes → 3.guide/5.recipes}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/.navigation.yml +0 -0
- /package/{2.guide/3.going-further → 3.guide/6.going-further}/index.md +0 -0
- /package/{3.api → 4.api}/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/.navigation.yml +0 -0
- /package/{3.api → 4.api}/1.components/1.client-only.md +0 -0
- /package/{3.api → 4.api}/1.components/1.dev-only.md +0 -0
- /package/{3.api → 4.api}/1.components/9.nuxt-img.md +0 -0
- /package/{3.api → 4.api}/2.composables/.navigation.yml +0 -0
- /package/{3.api → 4.api}/2.composables/on-prehydrate.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-hydration.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-loading-indicator.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-preview-mode.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-event.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-fetch.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-header.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-headers.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-request-url.md +0 -0
- /package/{3.api → 4.api}/2.composables/use-runtime-hook.md +0 -0
- /package/{3.api → 4.api}/3.utils/.navigation.yml +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-data.md +0 -0
- /package/{3.api → 4.api}/3.utils/clear-nuxt-state.md +0 -0
- /package/{3.api → 4.api}/3.utils/on-nuxt-ready.md +0 -0
- /package/{3.api → 4.api}/3.utils/prefetch-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/preload-components.md +0 -0
- /package/{3.api → 4.api}/3.utils/prerender-routes.md +0 -0
- /package/{3.api → 4.api}/4.commands/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/.navigation.yml +0 -0
- /package/{3.api → 4.api}/5.kit/10.runtime-config.md +0 -0
- /package/{3.api → 4.api}/5.kit/13.logging.md +0 -0
- /package/{3.api → 4.api}/5.kit/15.examples.md +0 -0
- /package/{3.api → 4.api}/5.kit/7.pages.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.head.md +0 -0
- /package/{3.api → 4.api}/5.kit/9.plugins.md +0 -0
- /package/{3.api → 4.api}/6.advanced/.navigation.yml +0 -0
- /package/{3.api → 4.api}/6.advanced/2.import-meta.md +0 -0
- /package/{3.api → 4.api}/6.nuxt-config.md +0 -0
|
@@ -115,7 +115,7 @@ Nuxt has built-in support for loading `.env` files. Avoid directly importing it
|
|
|
115
115
|
|
|
116
116
|
## Modules
|
|
117
117
|
|
|
118
|
-
Nuxt and Nuxt
|
|
118
|
+
Nuxt and Nuxt modules are now build-time-only.
|
|
119
119
|
|
|
120
120
|
### Migration
|
|
121
121
|
|
|
@@ -133,14 +133,14 @@ Nuxt and Nuxt Modules are now build-time-only.
|
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
::tip
|
|
136
|
-
If you are a module author, you can check out [more information about module compatibility](/docs/3.x/migration/module-authors) and [our module author guide](/docs/3.x/guide/
|
|
136
|
+
If you are a module author, you can check out [more information about module compatibility](/docs/3.x/migration/module-authors) and [our module author guide](/docs/3.x/guide/modules).
|
|
137
137
|
::
|
|
138
138
|
|
|
139
139
|
## Directory Changes
|
|
140
140
|
|
|
141
141
|
The `static/` (for storing static assets) has been renamed to `public/`. You can either rename your `static` directory to `public`, or keep the name by setting `dir.public` in your `nuxt.config`.
|
|
142
142
|
|
|
143
|
-
:read-more{to="/docs/
|
|
143
|
+
:read-more{to="/docs/3.x/directory-structure/public"}
|
|
144
144
|
|
|
145
145
|
## TypeScript
|
|
146
146
|
|
|
@@ -163,13 +163,13 @@ Nuxt can type-check your app using [`vue-tsc`](https://github.com/vuejs/language
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
1. Run `npx nuxt prepare` to generate `.nuxt/tsconfig.json`.
|
|
166
|
-
1. Install Volar following the instructions in the [docs](/docs/3.x/getting-started/
|
|
166
|
+
1. Install Volar following the instructions in the [docs](/docs/3.x/getting-started/installation#prerequisites).
|
|
167
167
|
|
|
168
168
|
## Vue Changes
|
|
169
169
|
|
|
170
170
|
There are a number of changes to what is recommended Vue best practice, as well as a number of breaking changes between Vue 2 and 3.
|
|
171
171
|
|
|
172
|
-
It is recommended to read the [Vue 3 migration guide](https://v3-migration.vuejs.org) and in particular the [breaking changes list](https://v3-migration.vuejs.org/breaking-changes).
|
|
172
|
+
It is recommended to read the [Vue 3 migration guide](https://v3-migration.vuejs.org) and in particular the [breaking changes list](https://v3-migration.vuejs.org/breaking-changes/).
|
|
173
173
|
|
|
174
174
|
It is not currently possible to use the [Vue 3 migration build](https://v3-migration.vuejs.org/migration-build.html) with Nuxt 3.
|
|
175
175
|
|
|
@@ -213,7 +213,7 @@ export const useMainStore = defineStore('main', {
|
|
|
213
213
|
})
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
Create a [plugin](/docs/3.x/
|
|
216
|
+
Create a [plugin](/docs/3.x/directory-structure/plugins) file to globalize your store:
|
|
217
217
|
|
|
218
218
|
```ts [plugins/pinia.ts]
|
|
219
219
|
import { useMainStore } from '~/store'
|
|
@@ -7,7 +7,7 @@ description: 'Learn how to migrate from Nuxt 2 to Nuxt 3 modules.'
|
|
|
7
7
|
|
|
8
8
|
Nuxt 3 has a basic backward compatibility layer for Nuxt 2 modules using `@nuxt/kit` auto wrappers. But there are usually steps to follow to make modules compatible with Nuxt 3 and sometimes, using Nuxt Bridge is required for cross-version compatibility.
|
|
9
9
|
|
|
10
|
-
We have prepared a [Dedicated Guide](/docs/3.x/guide/
|
|
10
|
+
We have prepared a [Dedicated Guide](/docs/3.x/guide/modules) for authoring Nuxt 3 ready modules using `@nuxt/kit`. Currently best migration path is to follow it and rewrite your modules. Rest of this guide includes preparation steps if you prefer to avoid a full rewrite yet making modules compatible with Nuxt 3.
|
|
11
11
|
|
|
12
12
|
::tip{icon="i-lucide-puzzle" to="/modules"}
|
|
13
13
|
Explore Nuxt 3 compatible modules.
|
|
@@ -17,7 +17,7 @@ Explore Nuxt 3 compatible modules.
|
|
|
17
17
|
|
|
18
18
|
Nuxt 3 plugins are **not** fully backward compatible with Nuxt 2.
|
|
19
19
|
|
|
20
|
-
:read-more{to="/docs/
|
|
20
|
+
:read-more{to="/docs/3.x/directory-structure/plugins"}
|
|
21
21
|
|
|
22
22
|
### Vue Compatibility
|
|
23
23
|
|
|
@@ -78,7 +78,7 @@ Your module should work even if it's only added to [`buildModules`](/docs/3.x/ap
|
|
|
78
78
|
(*) Unless it is for `nuxt dev` purpose only and guarded with `if (nuxt.options.dev) { }`.
|
|
79
79
|
|
|
80
80
|
::tip
|
|
81
|
-
Continue reading about Nuxt 3 modules in the [Modules Author Guide](/docs/3.x/guide/
|
|
81
|
+
Continue reading about Nuxt 3 modules in the [Modules Author Guide](/docs/3.x/guide/modules).
|
|
82
82
|
::
|
|
83
83
|
|
|
84
84
|
### Use TypeScript (Optional)
|
|
@@ -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/3.x/
|
|
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/3.x/directory-structure/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.
|
package/7.migration/4.meta.md
CHANGED
|
@@ -14,7 +14,7 @@ You can customize `title`, `titleTemplate`, `base`, `script`, `noscript`, `style
|
|
|
14
14
|
Nuxt currently uses [`Unhead`](https://github.com/unjs/unhead) to manage your meta tags, but implementation details may change.
|
|
15
15
|
::
|
|
16
16
|
|
|
17
|
-
:read-more{to="/docs/getting-started/seo-meta"}
|
|
17
|
+
:read-more{to="/docs/3.x/getting-started/seo-meta"}
|
|
18
18
|
|
|
19
19
|
## Migration
|
|
20
20
|
|
|
@@ -31,9 +31,9 @@ export default defineNuxtPlugin((nuxtApp) => {
|
|
|
31
31
|
|
|
32
32
|
::
|
|
33
33
|
|
|
34
|
-
:read-more{to="/docs/
|
|
34
|
+
:read-more{to="/docs/3.x/directory-structure/plugins"}
|
|
35
35
|
|
|
36
|
-
::read-more{to="/docs/api/composables/use-nuxt-app"}
|
|
36
|
+
::read-more{to="/docs/3.x/api/composables/use-nuxt-app"}
|
|
37
37
|
Read more about the format of `nuxtApp`.
|
|
38
38
|
::
|
|
39
39
|
|
|
@@ -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/
|
|
75
|
+
:read-more{to="/docs/3.x/directory-structure/middleware"}
|
|
76
76
|
|
|
77
77
|
### Migration
|
|
78
78
|
|
|
@@ -13,19 +13,19 @@ If you don't have an `app.vue` file in your source directory, Nuxt will use its
|
|
|
13
13
|
|
|
14
14
|
This file is a great place to put any custom code that needs to be run once when your app starts up, as well as any components that are present on every page of your app. For example, if you only have one layout, you can move this to `app.vue` instead.
|
|
15
15
|
|
|
16
|
-
:read-more{to="/docs/
|
|
16
|
+
:read-more{to="/docs/3.x/directory-structure/app"}
|
|
17
17
|
|
|
18
|
-
:link-example{to="/docs/examples/hello-world"}
|
|
18
|
+
:link-example{to="/docs/3.x/examples/hello-world"}
|
|
19
19
|
|
|
20
20
|
### Migration
|
|
21
21
|
|
|
22
|
-
Consider creating an `app.vue` file and including any logic that needs to run once at the top-level of your app. You can check out [an example here](/docs/3.x/
|
|
22
|
+
Consider creating an `app.vue` file and including any logic that needs to run once at the top-level of your app. You can check out [an example here](/docs/3.x/directory-structure/app).
|
|
23
23
|
|
|
24
24
|
## Layouts
|
|
25
25
|
|
|
26
26
|
If you are using layouts in your app for multiple pages, there is only a slight change required.
|
|
27
27
|
|
|
28
|
-
In Nuxt 2, the `<Nuxt>` component is used within a layout to render the current page. In Nuxt 3, layouts use slots instead, so you will have to replace that component with a `<slot />`. This also allows advanced use cases with named and scoped slots. [Read more about layouts](/docs/3.x/
|
|
28
|
+
In Nuxt 2, the `<Nuxt>` component is used within a layout to render the current page. In Nuxt 3, layouts use slots instead, so you will have to replace that component with a `<slot />`. This also allows advanced use cases with named and scoped slots. [Read more about layouts](/docs/3.x/directory-structure/layouts).
|
|
29
29
|
|
|
30
30
|
You will also need to change how you define the layout used by a page using the `definePageMeta` compiler macro. Layouts will be kebab-cased. So `layouts/customLayout.vue` becomes `custom-layout` when referenced in your page.
|
|
31
31
|
|
|
@@ -54,7 +54,7 @@ You will also need to change how you define the layout used by a page using the
|
|
|
54
54
|
- }
|
|
55
55
|
</script>
|
|
56
56
|
```
|
|
57
|
-
3. Move `~/layouts/_error.vue` to `~/error.vue`. See [the error handling docs](/docs/3.x/getting-started/error-handling). If you want to ensure that this page uses a layout, you can use [`<NuxtLayout>`](/docs/3.x/
|
|
57
|
+
3. Move `~/layouts/_error.vue` to `~/error.vue`. See [the error handling docs](/docs/3.x/getting-started/error-handling). If you want to ensure that this page uses a layout, you can use [`<NuxtLayout>`](/docs/3.x/directory-structure/layouts) directly within `error.vue`:
|
|
58
58
|
```vue [error.vue]
|
|
59
59
|
<template>
|
|
60
60
|
<div>
|
|
@@ -67,7 +67,7 @@ You will also need to change how you define the layout used by a page using the
|
|
|
67
67
|
|
|
68
68
|
## Pages
|
|
69
69
|
|
|
70
|
-
Nuxt 3 ships with an optional `vue-router` integration triggered by the existence of a [`pages/`](/docs/3.x/
|
|
70
|
+
Nuxt 3 ships with an optional `vue-router` integration triggered by the existence of a [`pages/`](/docs/3.x/directory-structure/pages) directory in your source directory. If you only have a single page, you may consider instead moving it to `app.vue` for a lighter build.
|
|
71
71
|
|
|
72
72
|
### Dynamic Routes
|
|
73
73
|
|
|
@@ -84,13 +84,13 @@ In Nuxt 2, you will have defined any nested routes (with parent and child compon
|
|
|
84
84
|
|
|
85
85
|
If you were passing a custom page key or keep-alive props to `<Nuxt>`, you will now use `definePageMeta` to set these options.
|
|
86
86
|
|
|
87
|
-
:read-more{to="/docs/
|
|
87
|
+
:read-more{to="/docs/3.x/directory-structure/pages#special-metadata"}
|
|
88
88
|
|
|
89
89
|
### Page and Layout Transitions
|
|
90
90
|
|
|
91
91
|
If you have been defining transitions for your page or layout directly in your component options, you will now need to use `definePageMeta` to set the transition. Since Vue 3, [-enter and -leave CSS classes have been renamed](https://v3-migration.vuejs.org/breaking-changes/transition.html). The `style` prop from `<Nuxt>` no longer applies to transition when used on `<slot>`, so move the styles to your `-active` class.
|
|
92
92
|
|
|
93
|
-
:read-more{to="/docs/getting-started/transitions"}
|
|
93
|
+
:read-more{to="/docs/3.x/getting-started/transitions"}
|
|
94
94
|
|
|
95
95
|
### Migration
|
|
96
96
|
|
|
@@ -190,7 +190,7 @@ Most of the syntax and functionality are the same for the global [NuxtLink](/doc
|
|
|
190
190
|
|
|
191
191
|
`<NuxtLink>` is now a drop-in replacement for _all_ links, even external ones. You can read more about it, and how to extend it to provide your own link component.
|
|
192
192
|
|
|
193
|
-
:read-more{to="/docs/api/components/nuxt-link"}
|
|
193
|
+
:read-more{to="/docs/3.x/api/components/nuxt-link"}
|
|
194
194
|
|
|
195
195
|
## Programmatic Navigation
|
|
196
196
|
|
|
@@ -67,7 +67,7 @@ Despite the names, [`useFetch`](/docs/3.x/api/composables/use-fetch) is not a di
|
|
|
67
67
|
|
|
68
68
|
## `head`
|
|
69
69
|
|
|
70
|
-
:read-more{to="/docs/migration/meta"}
|
|
70
|
+
:read-more{to="/docs/3.x/migration/meta"}
|
|
71
71
|
|
|
72
72
|
## `key`
|
|
73
73
|
|
|
@@ -91,7 +91,7 @@ You can now define a key within the [`definePageMeta`](/docs/3.x/api/utils/defin
|
|
|
91
91
|
|
|
92
92
|
## `layout`
|
|
93
93
|
|
|
94
|
-
:read-more{to="/docs/migration/pages-and-layouts"}
|
|
94
|
+
:read-more{to="/docs/3.x/migration/pages-and-layouts"}
|
|
95
95
|
|
|
96
96
|
## `loading`
|
|
97
97
|
|
|
@@ -99,11 +99,11 @@ This feature is not yet supported in Nuxt 3.
|
|
|
99
99
|
|
|
100
100
|
## `middleware`
|
|
101
101
|
|
|
102
|
-
:read-more{to="/docs/migration/plugins-and-middleware"}
|
|
102
|
+
:read-more{to="/docs/3.x/migration/plugins-and-middleware"}
|
|
103
103
|
|
|
104
104
|
## `scrollToTop`
|
|
105
105
|
|
|
106
|
-
This feature is not yet supported in Nuxt 3. If you want to overwrite the default scroll behavior of `vue-router`, you can do so in `~/app/router.options.ts` (see [docs](/docs/3.x/guide/recipes/custom-routing#router-options)) for more info.
|
|
106
|
+
This feature is not yet supported in Nuxt 3. If you want to overwrite the default scroll behavior of `vue-router`, you can do so in an `~/app/router.options.ts` (see [docs](/docs/3.x/guide/recipes/custom-routing#router-options)) for more info.
|
|
107
107
|
Similar to `key`, specify it within the [`definePageMeta`](/docs/3.x/api/utils/define-page-meta) compiler macro.
|
|
108
108
|
|
|
109
109
|
```diff [pages/index.vue]
|
|
@@ -120,11 +120,11 @@ Similar to `key`, specify it within the [`definePageMeta`](/docs/3.x/api/utils/d
|
|
|
120
120
|
|
|
121
121
|
## `transition`
|
|
122
122
|
|
|
123
|
-
:read-more{to="/docs/getting-started/transitions"}
|
|
123
|
+
:read-more{to="/docs/3.x/getting-started/transitions"}
|
|
124
124
|
|
|
125
125
|
## `validate`
|
|
126
126
|
|
|
127
|
-
The validate hook in Nuxt 3 only accepts a single argument, the `route`. Just as in Nuxt 2, you can return a boolean value. If you return false and another match can't be found, this will mean a 404. You can also directly return an object with `
|
|
127
|
+
The validate hook in Nuxt 3 only accepts a single argument, the `route`. Just as in Nuxt 2, you can return a boolean value. If you return false and another match can't be found, this will mean a 404. You can also directly return an object with `status`/`statusText` to respond immediately with an error (other matches will not be checked).
|
|
128
128
|
|
|
129
129
|
```diff [pages/users/[id\\].vue]
|
|
130
130
|
- <script>
|
|
@@ -9,7 +9,7 @@ When referencing these variables within your components, you will have to use th
|
|
|
9
9
|
|
|
10
10
|
In the `server/` portion of your app, you can use [`useRuntimeConfig`](/docs/3.x/api/composables/use-runtime-config) without any import.
|
|
11
11
|
|
|
12
|
-
:read-more{to="/docs/guide/going-further/runtime-config"}
|
|
12
|
+
:read-more{to="/docs/3.x/guide/going-further/runtime-config"}
|
|
13
13
|
|
|
14
14
|
## Migration
|
|
15
15
|
|
package/package.json
CHANGED
package/2.guide/0.index.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 'Nuxt Guide'
|
|
3
|
-
titleTemplate: '%s'
|
|
4
|
-
description: 'Learn how Nuxt works with in-depth guides.'
|
|
5
|
-
navigation: false
|
|
6
|
-
surround: false
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
::card-group{class="sm:grid-cols-1"}
|
|
10
|
-
::card{icon="i-lucide-folders" title="Directory Structure" to="/docs/guide/directory-structure"}
|
|
11
|
-
Learn about Nuxt directory structure and what benefits each directory or file offers.
|
|
12
|
-
::
|
|
13
|
-
::card{icon="i-lucide-medal" title="Key Concepts" to="/docs/guide/concepts"}
|
|
14
|
-
Discover the main concepts behind Nuxt, from auto-import, hybrid rendering to its TypeScript support.
|
|
15
|
-
::
|
|
16
|
-
::card{icon="i-lucide-star" title="Going Further" to="/docs/guide/going-further"}
|
|
17
|
-
Master Nuxt with advanced concepts like experimental features, hooks, modules, and more.
|
|
18
|
-
::
|
|
19
|
-
::card{icon="i-lucide-book-open" title="Recipes" to="/docs/guide/recipes"}
|
|
20
|
-
Find solutions to common problems and learn how to implement them in your Nuxt project.
|
|
21
|
-
::
|
|
22
|
-
::card{icon="i-lucide-square-check" title="Best Practices" to="/docs/guide/best-practices"}
|
|
23
|
-
Learn about best practices when developing with Nuxt
|
|
24
|
-
::
|
|
25
|
-
::
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Features"
|
|
3
|
-
description: "Enable or disable optional Nuxt features to unlock new possibilities."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Some features of Nuxt are available on an opt-in basis, or can be disabled based on your needs.
|
|
7
|
-
|
|
8
|
-
## `features`
|
|
9
|
-
|
|
10
|
-
### inlineStyles
|
|
11
|
-
|
|
12
|
-
Inlines styles when rendering HTML. This is currently available only when using Vite.
|
|
13
|
-
|
|
14
|
-
You can also pass a function that receives the path of a Vue component and returns a boolean indicating whether to inline the styles for that component.
|
|
15
|
-
|
|
16
|
-
```ts [nuxt.config.ts]
|
|
17
|
-
export default defineNuxtConfig({
|
|
18
|
-
features: {
|
|
19
|
-
inlineStyles: false, // or a function to determine inlining
|
|
20
|
-
},
|
|
21
|
-
})
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### noScripts
|
|
25
|
-
|
|
26
|
-
Disables rendering of Nuxt scripts and JS resource hints. Can also be configured granularly within `routeRules`.
|
|
27
|
-
|
|
28
|
-
```ts [nuxt.config.ts]
|
|
29
|
-
export default defineNuxtConfig({
|
|
30
|
-
features: {
|
|
31
|
-
noScripts: true,
|
|
32
|
-
},
|
|
33
|
-
})
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## `future`
|
|
37
|
-
|
|
38
|
-
There is also a `future` namespace for early opting-in to new features that will become default in a future (possibly major) version of the framework.
|
|
39
|
-
|
|
40
|
-
### compatibilityVersion
|
|
41
|
-
|
|
42
|
-
::important
|
|
43
|
-
This configuration option is available in Nuxt v3.12+. Please note, that for now, you need to define the compatibility version in each layer that opts into Nuxt 4 behavior. This will not be required after Nuxt 4 is released.
|
|
44
|
-
::
|
|
45
|
-
|
|
46
|
-
This enables early access to Nuxt features or flags.
|
|
47
|
-
|
|
48
|
-
Setting `compatibilityVersion` to `4` changes defaults throughout your
|
|
49
|
-
Nuxt configuration to opt-in to Nuxt v4 behaviour, but you can granularly re-enable Nuxt v3 behaviour
|
|
50
|
-
when testing (see example). Please file issues if so, so that we can
|
|
51
|
-
address in Nuxt or in the ecosystem.
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
export default defineNuxtConfig({
|
|
55
|
-
future: {
|
|
56
|
-
compatibilityVersion: 4,
|
|
57
|
-
},
|
|
58
|
-
// To re-enable _all_ Nuxt v3 behaviour, set the following options:
|
|
59
|
-
srcDir: '.',
|
|
60
|
-
dir: {
|
|
61
|
-
app: 'app',
|
|
62
|
-
},
|
|
63
|
-
experimental: {
|
|
64
|
-
scanPageMeta: 'after-resolve',
|
|
65
|
-
sharedPrerenderData: false,
|
|
66
|
-
compileTemplate: true,
|
|
67
|
-
resetAsyncDataToUndefined: true,
|
|
68
|
-
templateUtils: true,
|
|
69
|
-
relativeWatchPaths: true,
|
|
70
|
-
normalizeComponentNames: false,
|
|
71
|
-
defaults: {
|
|
72
|
-
useAsyncData: {
|
|
73
|
-
deep: true,
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
features: {
|
|
78
|
-
inlineStyles: true,
|
|
79
|
-
},
|
|
80
|
-
unhead: {
|
|
81
|
-
renderSSRHeadOptions: {
|
|
82
|
-
omitLineBreaks: false,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
})
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### typescriptBundlerResolution
|
|
89
|
-
|
|
90
|
-
This enables 'Bundler' module resolution mode for TypeScript, which is the recommended setting
|
|
91
|
-
for frameworks like Nuxt and [Vite](https://vite.dev/guide/performance.html#reduce-resolve-operations).
|
|
92
|
-
|
|
93
|
-
It improves type support when using modern libraries with `exports`.
|
|
94
|
-
|
|
95
|
-
See [the original TypeScript pull request](https://github.com/microsoft/TypeScript/pull/51669).
|
|
96
|
-
|
|
97
|
-
```ts [nuxt.config.ts]
|
|
98
|
-
export default defineNuxtConfig({
|
|
99
|
-
future: {
|
|
100
|
-
typescriptBundlerResolution: true,
|
|
101
|
-
},
|
|
102
|
-
})
|
|
103
|
-
```
|