@nuxt/docs 3.19.2 → 3.19.3
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 +2 -2
- package/1.getting-started/02.installation.md +1 -0
- package/1.getting-started/03.configuration.md +29 -29
- package/1.getting-started/04.views.md +7 -7
- package/1.getting-started/05.assets.md +15 -9
- package/1.getting-started/06.styling.md +55 -45
- package/1.getting-started/07.routing.md +12 -12
- package/1.getting-started/08.seo-meta.md +55 -42
- package/1.getting-started/09.transitions.md +47 -42
- package/1.getting-started/10.data-fetching.md +90 -67
- package/1.getting-started/11.state-management.md +22 -15
- package/1.getting-started/12.error-handling.md +11 -9
- package/1.getting-started/13.server.md +3 -3
- package/1.getting-started/14.layers.md +21 -15
- package/1.getting-started/15.prerendering.md +28 -28
- package/1.getting-started/16.deployment.md +9 -9
- package/1.getting-started/17.testing.md +43 -43
- package/1.getting-started/18.upgrade.md +58 -57
- package/2.guide/0.index.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/.navigation.yml +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.nuxt.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/0.output.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.assets.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.components.md +41 -24
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.composables.md +11 -11
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.content.md +7 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.layouts.md +16 -12
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.middleware.md +28 -22
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.modules.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.node_modules.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.pages.md +33 -31
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.plugins.md +25 -25
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.public.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.server.md +34 -34
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.shared.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/1.utils.md +5 -5
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.env.md +5 -5
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.gitignore.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtignore.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/2.nuxtrc.md +3 -3
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.app-config.md +12 -12
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.app.md +4 -4
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.error.md +6 -6
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.nuxt-config.md +2 -2
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.package.md +1 -1
- package/2.guide/{2.directory-structure → 1.directory-structure}/3.tsconfig.md +3 -3
- package/2.guide/{1.concepts → 2.concepts}/1.auto-imports.md +18 -18
- package/2.guide/{1.concepts → 2.concepts}/10.nuxt-lifecycle.md +10 -10
- package/2.guide/{1.concepts → 2.concepts}/2.vuejs-development.md +9 -9
- package/2.guide/{1.concepts → 2.concepts}/3.rendering.md +21 -19
- package/2.guide/{1.concepts → 2.concepts}/4.server-engine.md +5 -5
- package/2.guide/{1.concepts → 2.concepts}/5.modules.md +4 -4
- package/2.guide/{1.concepts → 2.concepts}/7.esm.md +15 -13
- package/2.guide/{1.concepts → 2.concepts}/8.typescript.md +11 -11
- package/2.guide/3.going-further/1.events.md +2 -2
- package/2.guide/3.going-further/1.experimental-features.md +80 -80
- package/2.guide/3.going-further/1.features.md +15 -15
- package/2.guide/3.going-further/1.internals.md +25 -25
- package/2.guide/3.going-further/10.runtime-config.md +11 -11
- package/2.guide/3.going-further/2.hooks.md +11 -11
- package/2.guide/3.going-further/3.modules.md +89 -87
- package/2.guide/3.going-further/4.kit.md +5 -5
- package/2.guide/3.going-further/6.nuxt-app.md +5 -5
- package/2.guide/3.going-further/7.layers.md +61 -52
- package/2.guide/3.going-further/9.debugging.md +2 -2
- package/2.guide/4.recipes/1.custom-routing.md +31 -31
- package/2.guide/4.recipes/2.vite-plugin.md +4 -4
- package/2.guide/4.recipes/3.custom-usefetch.md +12 -12
- package/2.guide/4.recipes/4.sessions-and-authentication.md +34 -20
- package/2.guide/5.best-practices/hydration.md +4 -4
- package/2.guide/5.best-practices/performance.md +12 -12
- package/3.api/1.components/1.client-only.md +6 -3
- package/3.api/1.components/1.nuxt-client-fallback.md +9 -6
- package/3.api/1.components/10.nuxt-picture.md +1 -1
- package/3.api/1.components/11.teleports.md +4 -1
- package/3.api/1.components/12.nuxt-route-announcer.md +9 -9
- package/3.api/1.components/13.nuxt-time.md +44 -17
- package/3.api/1.components/2.nuxt-page.md +4 -4
- package/3.api/1.components/3.nuxt-layout.md +11 -6
- package/3.api/1.components/4.nuxt-link.md +40 -20
- package/3.api/1.components/5.nuxt-loading-indicator.md +2 -2
- package/3.api/1.components/6.nuxt-error-boundary.md +11 -9
- package/3.api/2.composables/on-prehydrate.md +2 -2
- package/3.api/2.composables/use-async-data.md +17 -17
- package/3.api/2.composables/use-cookie.md +28 -20
- package/3.api/2.composables/use-error.md +1 -1
- package/3.api/2.composables/use-fetch.md +55 -29
- package/3.api/2.composables/use-head-safe.md +7 -7
- package/3.api/2.composables/use-head.md +4 -4
- package/3.api/2.composables/use-hydration.md +6 -6
- package/3.api/2.composables/use-lazy-async-data.md +2 -2
- package/3.api/2.composables/use-lazy-fetch.md +2 -2
- package/3.api/2.composables/use-loading-indicator.md +12 -12
- package/3.api/2.composables/use-nuxt-app.md +19 -19
- package/3.api/2.composables/use-nuxt-data.md +8 -8
- package/3.api/2.composables/use-preview-mode.md +15 -18
- package/3.api/2.composables/use-request-event.md +1 -1
- package/3.api/2.composables/use-request-fetch.md +3 -3
- package/3.api/2.composables/use-request-header.md +1 -1
- package/3.api/2.composables/use-request-headers.md +4 -4
- package/3.api/2.composables/use-request-url.md +1 -1
- package/3.api/2.composables/use-response-header.md +9 -10
- package/3.api/2.composables/use-route-announcer.md +4 -4
- package/3.api/2.composables/use-route.md +1 -1
- package/3.api/2.composables/use-router.md +9 -7
- package/3.api/2.composables/use-runtime-config.md +6 -6
- package/3.api/2.composables/use-runtime-hook.md +2 -2
- package/3.api/2.composables/use-seo-meta.md +2 -2
- package/3.api/2.composables/use-server-seo-meta.md +4 -4
- package/3.api/2.composables/use-state.md +4 -4
- package/3.api/3.utils/$fetch.md +9 -7
- package/3.api/3.utils/abort-navigation.md +3 -3
- package/3.api/3.utils/add-route-middleware.md +5 -5
- package/3.api/3.utils/call-once.md +4 -4
- package/3.api/3.utils/clear-error.md +2 -2
- package/3.api/3.utils/clear-nuxt-data.md +3 -3
- package/3.api/3.utils/clear-nuxt-state.md +3 -3
- package/3.api/3.utils/create-error.md +1 -1
- package/3.api/3.utils/define-lazy-hydration-component.md +13 -13
- package/3.api/3.utils/define-nuxt-component.md +5 -5
- package/3.api/3.utils/define-nuxt-plugin.md +12 -12
- package/3.api/3.utils/define-nuxt-route-middleware.md +5 -5
- package/3.api/3.utils/define-page-meta.md +21 -21
- package/3.api/3.utils/define-route-rules.md +5 -5
- package/3.api/3.utils/navigate-to.md +10 -10
- package/3.api/3.utils/prefetch-components.md +1 -1
- package/3.api/3.utils/preload-components.md +1 -1
- package/3.api/3.utils/prerender-routes.md +3 -3
- package/3.api/3.utils/refresh-cookie.md +3 -3
- package/3.api/3.utils/refresh-nuxt-data.md +11 -6
- package/3.api/3.utils/reload-nuxt-app.md +2 -2
- package/3.api/3.utils/set-page-layout.md +1 -1
- package/3.api/3.utils/set-response-status.md +2 -2
- package/3.api/3.utils/show-error.md +4 -4
- package/3.api/3.utils/update-app-config.md +3 -2
- package/3.api/4.commands/add.md +1 -1
- package/3.api/4.commands/analyze.md +2 -1
- package/3.api/4.commands/build.md +2 -1
- package/3.api/4.commands/dev.md +5 -4
- package/3.api/4.commands/generate.md +2 -1
- package/3.api/4.commands/init.md +3 -2
- package/3.api/4.commands/module.md +4 -4
- package/3.api/4.commands/prepare.md +7 -2
- package/3.api/4.commands/preview.md +5 -4
- package/3.api/4.commands/test.md +40 -0
- package/3.api/4.commands/typecheck.md +4 -2
- package/3.api/4.commands/upgrade.md +3 -3
- package/3.api/5.kit/1.modules.md +36 -36
- package/3.api/5.kit/10.runtime-config.md +1 -1
- package/3.api/5.kit/10.templates.md +8 -6
- package/3.api/5.kit/11.nitro.md +62 -62
- package/3.api/5.kit/12.resolving.md +2 -2
- package/3.api/5.kit/14.builder.md +1 -0
- package/3.api/5.kit/15.examples.md +2 -2
- package/3.api/5.kit/16.layers.md +26 -26
- package/3.api/5.kit/3.compatibility.md +12 -12
- package/3.api/5.kit/4.autoimports.md +13 -13
- package/3.api/5.kit/5.components.md +7 -7
- package/3.api/5.kit/6.context.md +3 -3
- package/3.api/5.kit/7.pages.md +7 -7
- package/3.api/5.kit/8.layout.md +2 -2
- package/3.api/5.kit/9.plugins.md +6 -5
- package/3.api/6.advanced/1.hooks.md +2 -2
- package/3.api/6.advanced/2.import-meta.md +3 -3
- package/5.community/2.getting-help.md +1 -1
- package/5.community/3.reporting-bugs.md +1 -1
- package/5.community/4.contribution.md +6 -6
- package/5.community/5.framework-contribution.md +3 -3
- package/5.community/6.roadmap.md +1 -1
- package/6.bridge/1.overview.md +13 -13
- package/6.bridge/10.configuration.md +2 -1
- package/6.bridge/2.typescript.md +2 -2
- package/6.bridge/3.bridge-composition-api.md +6 -6
- package/6.bridge/4.plugins-and-middleware.md +9 -9
- package/6.bridge/5.nuxt3-compatible-api.md +19 -16
- package/6.bridge/6.meta.md +20 -19
- package/6.bridge/7.runtime-config.md +1 -1
- package/6.bridge/8.nitro.md +3 -3
- package/6.bridge/9.vite.md +4 -4
- package/7.migration/1.overview.md +2 -2
- package/7.migration/2.configuration.md +22 -20
- package/7.migration/20.module-authors.md +6 -6
- package/7.migration/3.auto-imports.md +3 -3
- package/7.migration/4.meta.md +20 -17
- package/7.migration/5.plugins-and-middleware.md +5 -5
- package/7.migration/6.pages-and-layouts.md +23 -19
- package/7.migration/7.component-options.md +14 -14
- package/7.migration/8.runtime-config.md +6 -6
- package/package.json +1 -1
- /package/2.guide/{1.concepts → 2.concepts}/.navigation.yml +0 -0
- /package/2.guide/{1.concepts → 2.concepts}/9.code-style.md +0 -0
|
@@ -5,7 +5,7 @@ description: "Nuxt is fully typed and provides helpful shortcuts to ensure you h
|
|
|
5
5
|
|
|
6
6
|
## Type-checking
|
|
7
7
|
|
|
8
|
-
By default, Nuxt doesn't check types when you run [`nuxt dev`](/docs/api/commands/dev) or [`nuxt build`](/docs/api/commands/build), for performance reasons.
|
|
8
|
+
By default, Nuxt doesn't check types when you run [`nuxt dev`](/docs/3.x/api/commands/dev) or [`nuxt build`](/docs/3.x/api/commands/build), for performance reasons.
|
|
9
9
|
|
|
10
10
|
To enable type-checking at build or development time, install `vue-tsc` and `typescript` as development dependency:
|
|
11
11
|
|
|
@@ -29,19 +29,19 @@ To enable type-checking at build or development time, install `vue-tsc` and `typ
|
|
|
29
29
|
|
|
30
30
|
::
|
|
31
31
|
|
|
32
|
-
Then, run [`nuxt typecheck`](/docs/api/commands/typecheck) command to check your types:
|
|
32
|
+
Then, run [`nuxt typecheck`](/docs/3.x/api/commands/typecheck) command to check your types:
|
|
33
33
|
|
|
34
34
|
```bash [Terminal]
|
|
35
35
|
npx nuxt typecheck
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
To enable type-checking at build or development time, you can also use the [`typescript.typeCheck`](/docs/api/nuxt-config#typecheck) option in your `nuxt.config` file:
|
|
38
|
+
To enable type-checking at build or development time, you can also use the [`typescript.typeCheck`](/docs/3.x/api/nuxt-config#typecheck) option in your `nuxt.config` file:
|
|
39
39
|
|
|
40
40
|
```ts twoslash [nuxt.config.ts]
|
|
41
41
|
export default defineNuxtConfig({
|
|
42
42
|
typescript: {
|
|
43
|
-
typeCheck: true
|
|
44
|
-
}
|
|
43
|
+
typeCheck: true,
|
|
44
|
+
},
|
|
45
45
|
})
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -60,24 +60,24 @@ Some of the references in the file are to files that are only generated within y
|
|
|
60
60
|
This file contains the recommended basic TypeScript configuration for your project, including resolved aliases injected by Nuxt or modules you are using, so you can get full type support and path auto-complete for aliases like `~/file` or `#build/file`.
|
|
61
61
|
|
|
62
62
|
::note
|
|
63
|
-
Consider using the `imports` section of [nuxt.config](/docs/api/nuxt-config#imports) to include directories beyond the default ones. This can be useful for auto-importing types which you're using across your app.
|
|
63
|
+
Consider using the `imports` section of [nuxt.config](/docs/3.x/api/nuxt-config#imports) to include directories beyond the default ones. This can be useful for auto-importing types which you're using across your app.
|
|
64
64
|
::
|
|
65
65
|
|
|
66
|
-
[Read more about how to extend this configuration](/docs/guide/directory-structure/tsconfig).
|
|
66
|
+
[Read more about how to extend this configuration](/docs/3.x/guide/directory-structure/tsconfig).
|
|
67
67
|
|
|
68
68
|
::tip{icon="i-lucide-video" to="https://youtu.be/umLI7SlPygY" target="_blank"}
|
|
69
69
|
Watch a video from Daniel Roe explaining built-in Nuxt aliases.
|
|
70
70
|
::
|
|
71
71
|
|
|
72
72
|
::note
|
|
73
|
-
Nitro also [auto-generates types](/docs/guide/concepts/server-engine#typed-api-routes) for API routes. Plus, Nuxt also generates types for globally available components and [auto-imports from your composables](/docs/guide/directory-structure/composables), plus other core functionality.
|
|
73
|
+
Nitro also [auto-generates types](/docs/3.x/guide/concepts/server-engine#typed-api-routes) for API routes. Plus, Nuxt also generates types for globally available components and [auto-imports from your composables](/docs/3.x/guide/directory-structure/composables), plus other core functionality.
|
|
74
74
|
::
|
|
75
75
|
|
|
76
76
|
::note
|
|
77
77
|
Keep in mind that all options extended from `./.nuxt/tsconfig.json` will be overwritten by the options defined in your `tsconfig.json`.
|
|
78
78
|
Overwriting options such as `"compilerOptions.paths"` with your own configuration will lead TypeScript to not factor in the module resolutions from `./.nuxt/tsconfig.json`. This can lead to module resolutions such as `#imports` not being recognized.
|
|
79
79
|
:br :br
|
|
80
|
-
In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the [`alias` property](/docs/api/nuxt-config#alias) within your `nuxt.config`. Nuxt will pick them up and extend `./.nuxt/tsconfig.json` accordingly.
|
|
80
|
+
In case you need to extend options provided by `./.nuxt/tsconfig.json` further, you can use the [`alias` property](/docs/3.x/api/nuxt-config#alias) within your `nuxt.config`. Nuxt will pick them up and extend `./.nuxt/tsconfig.json` accordingly.
|
|
81
81
|
::
|
|
82
82
|
|
|
83
83
|
### Augmenting Types with Project References
|
|
@@ -105,7 +105,7 @@ If you are currently converting your codebase to TypeScript, you may want to tem
|
|
|
105
105
|
```ts twoslash [nuxt.config.ts]
|
|
106
106
|
export default defineNuxtConfig({
|
|
107
107
|
typescript: {
|
|
108
|
-
strict: false
|
|
109
|
-
}
|
|
108
|
+
strict: false,
|
|
109
|
+
},
|
|
110
110
|
})
|
|
111
111
|
```
|
|
@@ -16,7 +16,7 @@ You can create your own custom events using the `hook` method:
|
|
|
16
16
|
```ts
|
|
17
17
|
const nuxtApp = useNuxtApp()
|
|
18
18
|
|
|
19
|
-
nuxtApp.hook('app:user:registered', payload => {
|
|
19
|
+
nuxtApp.hook('app:user:registered', (payload) => {
|
|
20
20
|
console.log('A new user has registered!', payload)
|
|
21
21
|
})
|
|
22
22
|
```
|
|
@@ -37,7 +37,7 @@ You can also use the payload object to enable two-way communication between the
|
|
|
37
37
|
```ts
|
|
38
38
|
const nuxtApp = useNuxtApp()
|
|
39
39
|
|
|
40
|
-
nuxtApp.hook('app:user:registered', payload => {
|
|
40
|
+
nuxtApp.hook('app:user:registered', (payload) => {
|
|
41
41
|
payload.message = 'Welcome to our app!'
|
|
42
42
|
})
|
|
43
43
|
|
|
@@ -5,7 +5,7 @@ description: "Enable Nuxt experimental features to unlock new possibilities."
|
|
|
5
5
|
|
|
6
6
|
The Nuxt experimental features can be enabled in the Nuxt configuration file.
|
|
7
7
|
|
|
8
|
-
Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You can refer to the [API documentation](/docs/api/configuration/nuxt-config#experimental) or the [source code](https://github.com/nuxt/nuxt/blob/main/packages/schema/src/config/experimental.ts) for more information.
|
|
8
|
+
Internally, Nuxt uses `@nuxt/schema` to define these experimental features. You can refer to the [API documentation](/docs/3.x/api/configuration/nuxt-config#experimental) or the [source code](https://github.com/nuxt/nuxt/blob/main/packages/schema/src/config/experimental.ts) for more information.
|
|
9
9
|
|
|
10
10
|
::note
|
|
11
11
|
Note that these features are experimental and could be removed or modified in the future.
|
|
@@ -18,8 +18,8 @@ Enable native async context to be accessible for nested composables in Nuxt and
|
|
|
18
18
|
```ts twoslash [nuxt.config.ts]
|
|
19
19
|
export default defineNuxtConfig({
|
|
20
20
|
experimental: {
|
|
21
|
-
asyncContext: true
|
|
22
|
-
}
|
|
21
|
+
asyncContext: true,
|
|
22
|
+
},
|
|
23
23
|
})
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -34,8 +34,8 @@ Enables generation of an async entry point for the Vue bundle, aiding module fed
|
|
|
34
34
|
```ts twoslash [nuxt.config.ts]
|
|
35
35
|
export default defineNuxtConfig({
|
|
36
36
|
experimental: {
|
|
37
|
-
asyncEntry: true
|
|
38
|
-
}
|
|
37
|
+
asyncEntry: true,
|
|
38
|
+
},
|
|
39
39
|
})
|
|
40
40
|
```
|
|
41
41
|
|
|
@@ -48,8 +48,8 @@ Externalizes `vue`, `@vue/*` and `vue-router` when building.
|
|
|
48
48
|
```ts twoslash [nuxt.config.ts]
|
|
49
49
|
export default defineNuxtConfig({
|
|
50
50
|
experimental: {
|
|
51
|
-
externalVue: true
|
|
52
|
-
}
|
|
51
|
+
externalVue: true,
|
|
52
|
+
},
|
|
53
53
|
})
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -66,8 +66,8 @@ Tree shakes contents of client-only components from server bundle.
|
|
|
66
66
|
```ts twoslash [nuxt.config.ts]
|
|
67
67
|
export default defineNuxtConfig({
|
|
68
68
|
experimental: {
|
|
69
|
-
treeshakeClientOnly: true
|
|
70
|
-
}
|
|
69
|
+
treeshakeClientOnly: true,
|
|
70
|
+
},
|
|
71
71
|
})
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -75,46 +75,46 @@ export default defineNuxtConfig({
|
|
|
75
75
|
|
|
76
76
|
Emits `app:chunkError` hook when there is an error loading vite/webpack chunks. Default behavior is to perform a reload of the new route on navigation to a new route when a chunk fails to load.
|
|
77
77
|
|
|
78
|
-
If you set this to `'automatic-immediate'` Nuxt will reload the current route immediately, instead of waiting for a navigation. This is useful for chunk errors that are not triggered by navigation, e.g., when your Nuxt app fails to load a [lazy component](/docs/guide/directory-structure/components#dynamic-imports). A potential downside of this behavior is undesired reloads, e.g., when your app does not need the chunk that caused the error.
|
|
78
|
+
If you set this to `'automatic-immediate'` Nuxt will reload the current route immediately, instead of waiting for a navigation. This is useful for chunk errors that are not triggered by navigation, e.g., when your Nuxt app fails to load a [lazy component](/docs/3.x/guide/directory-structure/components#dynamic-imports). A potential downside of this behavior is undesired reloads, e.g., when your app does not need the chunk that caused the error.
|
|
79
79
|
|
|
80
80
|
You can disable automatic handling by setting this to `false`, or handle chunk errors manually by setting it to `manual`.
|
|
81
81
|
|
|
82
82
|
```ts twoslash [nuxt.config.ts]
|
|
83
83
|
export default defineNuxtConfig({
|
|
84
84
|
experimental: {
|
|
85
|
-
emitRouteChunkError: 'automatic' // or 'automatic-immediate', 'manual' or false
|
|
86
|
-
}
|
|
85
|
+
emitRouteChunkError: 'automatic', // or 'automatic-immediate', 'manual' or false
|
|
86
|
+
},
|
|
87
87
|
})
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
## restoreState
|
|
91
91
|
|
|
92
|
-
Allows Nuxt app state to be restored from `sessionStorage` when reloading the page after a chunk error or manual [`reloadNuxtApp()`](/docs/api/utils/reload-nuxt-app) call.
|
|
92
|
+
Allows Nuxt app state to be restored from `sessionStorage` when reloading the page after a chunk error or manual [`reloadNuxtApp()`](/docs/3.x/api/utils/reload-nuxt-app) call.
|
|
93
93
|
|
|
94
94
|
To avoid hydration errors, it will be applied only after the Vue app has been mounted, meaning there may be a flicker on initial load.
|
|
95
95
|
|
|
96
96
|
::important
|
|
97
97
|
Consider carefully before enabling this as it can cause unexpected behavior,
|
|
98
|
-
and consider providing explicit keys to [`useState`](/docs/api/composables/use-state) as auto-generated keys may not match across builds.
|
|
98
|
+
and consider providing explicit keys to [`useState`](/docs/3.x/api/composables/use-state) as auto-generated keys may not match across builds.
|
|
99
99
|
::
|
|
100
100
|
|
|
101
101
|
```ts twoslash [nuxt.config.ts]
|
|
102
102
|
export default defineNuxtConfig({
|
|
103
103
|
experimental: {
|
|
104
|
-
restoreState: true
|
|
105
|
-
}
|
|
104
|
+
restoreState: true,
|
|
105
|
+
},
|
|
106
106
|
})
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
## inlineRouteRules
|
|
110
110
|
|
|
111
|
-
Define route rules at the page level using [`defineRouteRules`](/docs/api/utils/define-route-rules).
|
|
111
|
+
Define route rules at the page level using [`defineRouteRules`](/docs/3.x/api/utils/define-route-rules).
|
|
112
112
|
|
|
113
113
|
```ts twoslash [nuxt.config.ts]
|
|
114
114
|
export default defineNuxtConfig({
|
|
115
115
|
experimental: {
|
|
116
|
-
inlineRouteRules: true
|
|
117
|
-
}
|
|
116
|
+
inlineRouteRules: true,
|
|
117
|
+
},
|
|
118
118
|
})
|
|
119
119
|
```
|
|
120
120
|
|
|
@@ -135,8 +135,8 @@ Allows rendering of JSON payloads with support for revivifying complex types.
|
|
|
135
135
|
```ts twoslash [nuxt.config.ts]
|
|
136
136
|
export default defineNuxtConfig({
|
|
137
137
|
experimental: {
|
|
138
|
-
renderJsonPayloads: true
|
|
139
|
-
}
|
|
138
|
+
renderJsonPayloads: true,
|
|
139
|
+
},
|
|
140
140
|
})
|
|
141
141
|
```
|
|
142
142
|
|
|
@@ -147,8 +147,8 @@ Disables Vue server renderer endpoint within Nitro.
|
|
|
147
147
|
```ts twoslash [nuxt.config.ts]
|
|
148
148
|
export default defineNuxtConfig({
|
|
149
149
|
experimental: {
|
|
150
|
-
noVueServer: true
|
|
151
|
-
}
|
|
150
|
+
noVueServer: true,
|
|
151
|
+
},
|
|
152
152
|
})
|
|
153
153
|
```
|
|
154
154
|
|
|
@@ -159,20 +159,20 @@ Enables extraction of payloads of pages generated with `nuxt generate`.
|
|
|
159
159
|
```ts twoslash [nuxt.config.ts]
|
|
160
160
|
export default defineNuxtConfig({
|
|
161
161
|
experimental: {
|
|
162
|
-
payloadExtraction: true
|
|
163
|
-
}
|
|
162
|
+
payloadExtraction: true,
|
|
163
|
+
},
|
|
164
164
|
})
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
## clientFallback
|
|
168
168
|
|
|
169
|
-
Enables the experimental [`<NuxtClientFallback>`](/docs/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
|
|
169
|
+
Enables the experimental [`<NuxtClientFallback>`](/docs/3.x/api/components/nuxt-client-fallback) component for rendering content on the client if there's an error in SSR.
|
|
170
170
|
|
|
171
171
|
```ts twoslash [nuxt.config.ts]
|
|
172
172
|
export default defineNuxtConfig({
|
|
173
173
|
experimental: {
|
|
174
|
-
clientFallback: true
|
|
175
|
-
}
|
|
174
|
+
clientFallback: true,
|
|
175
|
+
},
|
|
176
176
|
})
|
|
177
177
|
```
|
|
178
178
|
|
|
@@ -183,8 +183,8 @@ Enables cross-origin prefetch using the Speculation Rules API.
|
|
|
183
183
|
```ts twoslash [nuxt.config.ts]
|
|
184
184
|
export default defineNuxtConfig({
|
|
185
185
|
experimental: {
|
|
186
|
-
crossOriginPrefetch: true
|
|
187
|
-
}
|
|
186
|
+
crossOriginPrefetch: true,
|
|
187
|
+
},
|
|
188
188
|
})
|
|
189
189
|
```
|
|
190
190
|
|
|
@@ -199,8 +199,8 @@ Enables View Transition API integration with client-side router.
|
|
|
199
199
|
```ts twoslash [nuxt.config.ts]
|
|
200
200
|
export default defineNuxtConfig({
|
|
201
201
|
experimental: {
|
|
202
|
-
viewTransition: true
|
|
203
|
-
}
|
|
202
|
+
viewTransition: true,
|
|
203
|
+
},
|
|
204
204
|
})
|
|
205
205
|
```
|
|
206
206
|
|
|
@@ -217,20 +217,20 @@ Enables writing of early hints when using node server.
|
|
|
217
217
|
```ts twoslash [nuxt.config.ts]
|
|
218
218
|
export default defineNuxtConfig({
|
|
219
219
|
experimental: {
|
|
220
|
-
writeEarlyHints: true
|
|
221
|
-
}
|
|
220
|
+
writeEarlyHints: true,
|
|
221
|
+
},
|
|
222
222
|
})
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
## componentIslands
|
|
226
226
|
|
|
227
|
-
Enables experimental component islands support with [`<NuxtIsland>`](/docs/api/components/nuxt-island) and `.island.vue` files.
|
|
227
|
+
Enables experimental component islands support with [`<NuxtIsland>`](/docs/3.x/api/components/nuxt-island) and `.island.vue` files.
|
|
228
228
|
|
|
229
229
|
```ts twoslash [nuxt.config.ts]
|
|
230
230
|
export default defineNuxtConfig({
|
|
231
231
|
experimental: {
|
|
232
|
-
componentIslands: true // false or 'local+remote'
|
|
233
|
-
}
|
|
232
|
+
componentIslands: true, // false or 'local+remote'
|
|
233
|
+
},
|
|
234
234
|
})
|
|
235
235
|
```
|
|
236
236
|
|
|
@@ -249,8 +249,8 @@ Enables config schema support.
|
|
|
249
249
|
```ts twoslash [nuxt.config.ts]
|
|
250
250
|
export default defineNuxtConfig({
|
|
251
251
|
experimental: {
|
|
252
|
-
configSchema: true
|
|
253
|
-
}
|
|
252
|
+
configSchema: true,
|
|
253
|
+
},
|
|
254
254
|
})
|
|
255
255
|
```
|
|
256
256
|
|
|
@@ -261,8 +261,8 @@ Adds a compatibility layer for modules, plugins, or user code relying on the old
|
|
|
261
261
|
```ts twoslash [nuxt.config.ts]
|
|
262
262
|
export default defineNuxtConfig({
|
|
263
263
|
experimental: {
|
|
264
|
-
polyfillVueUseHead: false
|
|
265
|
-
}
|
|
264
|
+
polyfillVueUseHead: false,
|
|
265
|
+
},
|
|
266
266
|
})
|
|
267
267
|
```
|
|
268
268
|
|
|
@@ -273,8 +273,8 @@ Allow disabling Nuxt SSR responses by setting the `x-nuxt-no-ssr` header.
|
|
|
273
273
|
```ts twoslash [nuxt.config.ts]
|
|
274
274
|
export default defineNuxtConfig({
|
|
275
275
|
experimental: {
|
|
276
|
-
respectNoSSRHeader: false
|
|
277
|
-
}
|
|
276
|
+
respectNoSSRHeader: false,
|
|
277
|
+
},
|
|
278
278
|
})
|
|
279
279
|
```
|
|
280
280
|
|
|
@@ -287,8 +287,8 @@ Resolve `~`, `~~`, `@` and `@@` aliases located within layers with respect to th
|
|
|
287
287
|
```ts twoslash [nuxt.config.ts]
|
|
288
288
|
export default defineNuxtConfig({
|
|
289
289
|
experimental: {
|
|
290
|
-
localLayerAliases: true
|
|
291
|
-
}
|
|
290
|
+
localLayerAliases: true,
|
|
291
|
+
},
|
|
292
292
|
})
|
|
293
293
|
```
|
|
294
294
|
|
|
@@ -299,12 +299,12 @@ Enable the new experimental typed router using [`unplugin-vue-router`](https://g
|
|
|
299
299
|
```ts twoslash [nuxt.config.ts]
|
|
300
300
|
export default defineNuxtConfig({
|
|
301
301
|
experimental: {
|
|
302
|
-
typedPages: true
|
|
303
|
-
}
|
|
302
|
+
typedPages: true,
|
|
303
|
+
},
|
|
304
304
|
})
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
Out of the box, this will enable typed usage of [`navigateTo`](/docs/api/utils/navigate-to), [`<NuxtLink>`](/docs/api/components/nuxt-link), [`router.push()`](/docs/api/composables/use-router) and more.
|
|
307
|
+
Out of the box, this will enable typed usage of [`navigateTo`](/docs/3.x/api/utils/navigate-to), [`<NuxtLink>`](/docs/3.x/api/components/nuxt-link), [`router.push()`](/docs/3.x/api/composables/use-router) and more.
|
|
308
308
|
|
|
309
309
|
You can even get typed params within a page by using `const route = useRoute('route-name')`.
|
|
310
310
|
|
|
@@ -329,8 +329,8 @@ You can also set this to `chokidar` to watch all files in your source directory.
|
|
|
329
329
|
```ts twoslash [nuxt.config.ts]
|
|
330
330
|
export default defineNuxtConfig({
|
|
331
331
|
experimental: {
|
|
332
|
-
watcher: 'chokidar-granular' // 'chokidar' or 'parcel' are also options
|
|
333
|
-
}
|
|
332
|
+
watcher: 'chokidar-granular', // 'chokidar' or 'parcel' are also options
|
|
333
|
+
},
|
|
334
334
|
})
|
|
335
335
|
```
|
|
336
336
|
|
|
@@ -343,8 +343,8 @@ fetch the same data in different pages.
|
|
|
343
343
|
```ts twoslash [nuxt.config.ts]
|
|
344
344
|
export default defineNuxtConfig({
|
|
345
345
|
experimental: {
|
|
346
|
-
sharedPrerenderData: true
|
|
347
|
-
}
|
|
346
|
+
sharedPrerenderData: true,
|
|
347
|
+
},
|
|
348
348
|
})
|
|
349
349
|
```
|
|
350
350
|
|
|
@@ -378,7 +378,7 @@ To make globals like `Buffer` work in the browser, you need to manually inject t
|
|
|
378
378
|
```ts
|
|
379
379
|
import { Buffer } from 'node:buffer'
|
|
380
380
|
|
|
381
|
-
globalThis.Buffer
|
|
381
|
+
globalThis.Buffer ||= Buffer
|
|
382
382
|
```
|
|
383
383
|
::
|
|
384
384
|
|
|
@@ -395,8 +395,8 @@ You can disable this feature if it causes issues in your project.
|
|
|
395
395
|
```ts twoslash [nuxt.config.ts]
|
|
396
396
|
export default defineNuxtConfig({
|
|
397
397
|
experimental: {
|
|
398
|
-
scanPageMeta: false
|
|
399
|
-
}
|
|
398
|
+
scanPageMeta: false,
|
|
399
|
+
},
|
|
400
400
|
})
|
|
401
401
|
```
|
|
402
402
|
|
|
@@ -407,8 +407,8 @@ Enables CookieStore support to listen for cookie updates (if supported by the br
|
|
|
407
407
|
```ts twoslash [nuxt.config.ts]
|
|
408
408
|
export default defineNuxtConfig({
|
|
409
409
|
experimental: {
|
|
410
|
-
cookieStore: true
|
|
411
|
-
}
|
|
410
|
+
cookieStore: true,
|
|
411
|
+
},
|
|
412
412
|
})
|
|
413
413
|
```
|
|
414
414
|
|
|
@@ -423,8 +423,8 @@ Caches Nuxt build artifacts based on a hash of the configuration and source file
|
|
|
423
423
|
```ts twoslash [nuxt.config.ts]
|
|
424
424
|
export default defineNuxtConfig({
|
|
425
425
|
experimental: {
|
|
426
|
-
buildCache: true
|
|
427
|
-
}
|
|
426
|
+
buildCache: true,
|
|
427
|
+
},
|
|
428
428
|
})
|
|
429
429
|
```
|
|
430
430
|
|
|
@@ -457,7 +457,7 @@ This option allows passing additional keys to extract from the page metadata whe
|
|
|
457
457
|
```vue
|
|
458
458
|
<script lang="ts" setup>
|
|
459
459
|
definePageMeta({
|
|
460
|
-
foo: 'bar'
|
|
460
|
+
foo: 'bar',
|
|
461
461
|
})
|
|
462
462
|
</script>
|
|
463
463
|
```
|
|
@@ -475,7 +475,7 @@ export default defineNuxtConfig({
|
|
|
475
475
|
})
|
|
476
476
|
```
|
|
477
477
|
|
|
478
|
-
This allows modules to access additional metadata from the page metadata in the build context. If you are using this within a module, it's recommended also to [augment the `NuxtPage` types with your keys](/docs/guide/directory-structure/pages#typing-custom-metadata).
|
|
478
|
+
This allows modules to access additional metadata from the page metadata in the build context. If you are using this within a module, it's recommended also to [augment the `NuxtPage` types with your keys](/docs/3.x/guide/directory-structure/pages#typing-custom-metadata).
|
|
479
479
|
|
|
480
480
|
## normalizeComponentNames
|
|
481
481
|
|
|
@@ -485,8 +485,8 @@ you would use to auto-import the component.
|
|
|
485
485
|
```ts twoslash [nuxt.config.ts]
|
|
486
486
|
export default defineNuxtConfig({
|
|
487
487
|
experimental: {
|
|
488
|
-
normalizeComponentNames: true
|
|
489
|
-
}
|
|
488
|
+
normalizeComponentNames: true,
|
|
489
|
+
},
|
|
490
490
|
})
|
|
491
491
|
```
|
|
492
492
|
|
|
@@ -535,8 +535,8 @@ This is enabled by default in development mode. If you need to disable this feat
|
|
|
535
535
|
```ts twoslash [nuxt.config.ts]
|
|
536
536
|
export default defineNuxtConfig({
|
|
537
537
|
experimental: {
|
|
538
|
-
browserDevtoolsTiming: false
|
|
539
|
-
}
|
|
538
|
+
browserDevtoolsTiming: false,
|
|
539
|
+
},
|
|
540
540
|
})
|
|
541
541
|
```
|
|
542
542
|
|
|
@@ -559,8 +559,8 @@ To enable it explicitly:
|
|
|
559
559
|
```ts twoslash [nuxt.config.ts]
|
|
560
560
|
export default defineNuxtConfig({
|
|
561
561
|
experimental: {
|
|
562
|
-
debugModuleMutation: true
|
|
563
|
-
}
|
|
562
|
+
debugModuleMutation: true,
|
|
563
|
+
},
|
|
564
564
|
})
|
|
565
565
|
```
|
|
566
566
|
|
|
@@ -577,8 +577,8 @@ Lazy hydration is enabled by default, but you can disable this feature:
|
|
|
577
577
|
```ts twoslash [nuxt.config.ts]
|
|
578
578
|
export default defineNuxtConfig({
|
|
579
579
|
experimental: {
|
|
580
|
-
lazyHydration: false
|
|
581
|
-
}
|
|
580
|
+
lazyHydration: false,
|
|
581
|
+
},
|
|
582
582
|
})
|
|
583
583
|
```
|
|
584
584
|
|
|
@@ -595,8 +595,8 @@ This is enabled by default, so if you're experiencing resolution conflicts in ce
|
|
|
595
595
|
```ts twoslash [nuxt.config.ts]
|
|
596
596
|
export default defineNuxtConfig({
|
|
597
597
|
experimental: {
|
|
598
|
-
templateImportResolution: false
|
|
599
|
-
}
|
|
598
|
+
templateImportResolution: false,
|
|
599
|
+
},
|
|
600
600
|
})
|
|
601
601
|
```
|
|
602
602
|
|
|
@@ -650,8 +650,8 @@ and ensures fresh data is loaded when needed, but it is possible to disable it:
|
|
|
650
650
|
```ts twoslash [nuxt.config.ts]
|
|
651
651
|
export default defineNuxtConfig({
|
|
652
652
|
experimental: {
|
|
653
|
-
purgeCachedData: false
|
|
654
|
-
}
|
|
653
|
+
purgeCachedData: false,
|
|
654
|
+
},
|
|
655
655
|
})
|
|
656
656
|
```
|
|
657
657
|
|
|
@@ -666,8 +666,8 @@ Whether to call and use the result from `getCachedData` when refreshing data for
|
|
|
666
666
|
```ts twoslash [nuxt.config.ts]
|
|
667
667
|
export default defineNuxtConfig({
|
|
668
668
|
experimental: {
|
|
669
|
-
granularCachedData: true
|
|
670
|
-
}
|
|
669
|
+
granularCachedData: true,
|
|
670
|
+
},
|
|
671
671
|
})
|
|
672
672
|
```
|
|
673
673
|
|
|
@@ -684,8 +684,8 @@ That means that when `immediate: false` is passed, `pending` will be `false` unt
|
|
|
684
684
|
```ts twoslash [nuxt.config.ts]
|
|
685
685
|
export default defineNuxtConfig({
|
|
686
686
|
experimental: {
|
|
687
|
-
pendingWhenIdle: false
|
|
688
|
-
}
|
|
687
|
+
pendingWhenIdle: false,
|
|
688
|
+
},
|
|
689
689
|
})
|
|
690
690
|
```
|
|
691
691
|
|
|
@@ -710,13 +710,13 @@ If you need to disable this feature you can do so:
|
|
|
710
710
|
```ts twoslash [nuxt.config.ts]
|
|
711
711
|
export default defineNuxtConfig({
|
|
712
712
|
experimental: {
|
|
713
|
-
entryImportMap: false
|
|
713
|
+
entryImportMap: false,
|
|
714
714
|
},
|
|
715
|
-
// or, better, simply tell vite your desired target
|
|
715
|
+
// or, better, simply tell vite your desired target
|
|
716
716
|
// which nuxt will respect
|
|
717
717
|
vite: {
|
|
718
718
|
build: {
|
|
719
|
-
target: 'safari13'
|
|
719
|
+
target: 'safari13',
|
|
720
720
|
},
|
|
721
721
|
},
|
|
722
722
|
})
|
|
@@ -16,8 +16,8 @@ You can also pass a function that receives the path of a Vue component and retur
|
|
|
16
16
|
```ts [nuxt.config.ts]
|
|
17
17
|
export default defineNuxtConfig({
|
|
18
18
|
features: {
|
|
19
|
-
inlineStyles: false // or a function to determine inlining
|
|
20
|
-
}
|
|
19
|
+
inlineStyles: false, // or a function to determine inlining
|
|
20
|
+
},
|
|
21
21
|
})
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -28,8 +28,8 @@ Disables rendering of Nuxt scripts and JS resource hints. Can also be configured
|
|
|
28
28
|
```ts [nuxt.config.ts]
|
|
29
29
|
export default defineNuxtConfig({
|
|
30
30
|
features: {
|
|
31
|
-
noScripts: true
|
|
32
|
-
}
|
|
31
|
+
noScripts: true,
|
|
32
|
+
},
|
|
33
33
|
})
|
|
34
34
|
```
|
|
35
35
|
|
|
@@ -58,7 +58,7 @@ export default defineNuxtConfig({
|
|
|
58
58
|
// To re-enable _all_ Nuxt v3 behaviour, set the following options:
|
|
59
59
|
srcDir: '.',
|
|
60
60
|
dir: {
|
|
61
|
-
app: 'app'
|
|
61
|
+
app: 'app',
|
|
62
62
|
},
|
|
63
63
|
experimental: {
|
|
64
64
|
scanPageMeta: 'after-resolve',
|
|
@@ -67,21 +67,21 @@ export default defineNuxtConfig({
|
|
|
67
67
|
resetAsyncDataToUndefined: true,
|
|
68
68
|
templateUtils: true,
|
|
69
69
|
relativeWatchPaths: true,
|
|
70
|
-
normalizeComponentNames: false
|
|
70
|
+
normalizeComponentNames: false,
|
|
71
71
|
defaults: {
|
|
72
72
|
useAsyncData: {
|
|
73
|
-
deep: true
|
|
74
|
-
}
|
|
75
|
-
}
|
|
73
|
+
deep: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
76
|
},
|
|
77
77
|
features: {
|
|
78
|
-
inlineStyles: true
|
|
78
|
+
inlineStyles: true,
|
|
79
79
|
},
|
|
80
80
|
unhead: {
|
|
81
81
|
renderSSRHeadOptions: {
|
|
82
|
-
omitLineBreaks: false
|
|
83
|
-
}
|
|
84
|
-
}
|
|
82
|
+
omitLineBreaks: false,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
85
|
})
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -97,7 +97,7 @@ See [the original TypeScript pull request](https://github.com/microsoft/TypeScri
|
|
|
97
97
|
```ts [nuxt.config.ts]
|
|
98
98
|
export default defineNuxtConfig({
|
|
99
99
|
future: {
|
|
100
|
-
typescriptBundlerResolution: true
|
|
101
|
-
}
|
|
100
|
+
typescriptBundlerResolution: true,
|
|
101
|
+
},
|
|
102
102
|
})
|
|
103
103
|
```
|