@nuxt/docs-nightly 5.0.0-29835892.99af6dec → 5.0.0-29836693.3006e5ac

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.
@@ -479,12 +479,22 @@ For proper syntax highlighting in SFC, you can use the postcss lang attribute.
479
479
  </style>
480
480
  ```
481
481
 
482
- By default, Nuxt comes with the following plugins already pre-configured:
482
+ With the default Vite builder, no PostCSS plugins are configured out of the box. Vite resolves `@import` and `url()` itself, and minifies CSS as part of the build.
483
483
 
484
- - [postcss-import](https://github.com/postcss/postcss-import): Improves the `@import` rule
485
- - [postcss-url](https://github.com/postcss/postcss-url): Transforms `url()` statements
486
- - [autoprefixer](https://github.com/postcss/autoprefixer): Automatically adds vendor prefixes
487
- - [cssnano](https://cssnano.github.io/cssnano/): Minification and purge
484
+ [autoprefixer](https://github.com/postcss/autoprefixer) and [cssnano](https://cssnano.github.io/cssnano/) are optional peer dependencies. To use either, install it and name it in `postcss.plugins`:
485
+
486
+ ```ts [nuxt.config.ts]
487
+ export default defineNuxtConfig({
488
+ postcss: {
489
+ plugins: {
490
+ autoprefixer: {},
491
+ cssnano: {},
492
+ },
493
+ },
494
+ })
495
+ ```
496
+
497
+ With the webpack builder, [postcss-import](https://github.com/postcss/postcss-import), [postcss-url](https://github.com/postcss/postcss-url), `autoprefixer` and `cssnano` are still configured for you.
488
498
 
489
499
  ## Leveraging Layouts For Multiple Styles
490
500
 
@@ -38,44 +38,50 @@ deno x nuxt upgrade
38
38
 
39
39
  To use the latest Nuxt build and test features before their release, read about the [nightly release channel](/docs/guide/going-further/nightly-release-channel) guide.
40
40
 
41
- ## Testing Nuxt 5
41
+ ## Migrating to Nuxt 5
42
42
 
43
- Nuxt 5 is **currently in development**. Until the release, it is possible to test many of Nuxt 5's breaking changes from Nuxt version 4.2+.
43
+ Nuxt 5 includes significant improvements and changes. This guide covers what changed and how to migrate an existing Nuxt 4 application.
44
44
 
45
- ### Opting in to Nuxt 5
45
+ First, upgrade Nuxt using the [instructions above](#upgrading-nuxt).
46
46
 
47
- First, upgrade Nuxt to the [latest release](https://github.com/nuxt/nuxt/releases).
47
+ Most Nuxt 5 behaviour is the new default. Where a change can still be configured, the section describing it names the option that restores the Nuxt 4 behaviour; where it cannot, the section says so.
48
48
 
49
- Then you can set your `future.compatibilityVersion` to match Nuxt 5 behavior:
49
+ The changes are:
50
50
 
51
- ```ts twoslash [nuxt.config.ts]
52
- export default defineNuxtConfig({
53
- future: {
54
- compatibilityVersion: 5,
55
- },
56
- })
57
- ```
58
-
59
- When you set your `future.compatibilityVersion` to `5`, defaults throughout your Nuxt configuration will change to opt in to Nuxt v5 behavior, including:
60
-
61
- - **Vite Environment API**: Uses the new [Vite Environment API](/docs/getting-started/upgrade#migration-to-vite-environment-api) for improved build configuration
51
+ - **Nitro v3**: The server engine is [rewritten on h3 v2 and srvx](/docs/getting-started/upgrade#migration-to-nitro-v3), with a [compatibility layer](/docs/getting-started/upgrade#nitro-v2-compatibility) for server code you have not migrated yet
52
+ - **Server imports**: Server utilities come from [`nuxt/server`](/docs/getting-started/upgrade#server-imports-move-to-nuxtserver), including [session helpers](/docs/getting-started/upgrade#sessions-come-from-nuxtserver)
53
+ - **Vite Environment API**: Vite plugins are [registered and configured per environment](/docs/getting-started/upgrade#migration-to-vite-environment-api)
54
+ - **Vite 8**: The bundler is [Rolldown rather than esbuild and Rollup](/docs/getting-started/upgrade#migration-to-vite-8)
55
+ - **Nitro as a Vite environment**: With `@nuxt/vite-builder`, server and client are [built by one Vite build](/docs/getting-started/upgrade#nitro-builds-as-a-vite-environment)
56
+ - **Typed `$fetch`**: `$fetch` and `useFetch` are typed from [generated route types](/docs/getting-started/upgrade#typed-fetch-rebuilt-on-generated-route-types) rather than nitro's `InternalApi`
57
+ - **`jiti` is no longer bundled**: `nuxt.config`, `modules/` and layer configs are [loaded by the runtime](/docs/getting-started/upgrade#jiti-is-no-longer-bundled)
58
+ - **`process.*` type augmentation removed**: TypeScript no longer exposes [deprecated `process.*` flags](/docs/getting-started/upgrade#process-type-augmentation-removed) on `NodeJS.Process`
62
59
  - **Case-sensitive routing**: Page routes [match URL casing exactly](/docs/getting-started/upgrade#case-sensitive-routing), consistent with Nitro
63
- - **Normalized Page Names**: Page component names will [match their route names](/docs/getting-started/upgrade#normalized-page-component-names) for consistent `<KeepAlive>` behavior
64
- - **`clearNuxtState` resets to defaults**: `clearNuxtState` will [reset state to its initial value](/docs/getting-started/upgrade#respect-defaults-when-clearing-usestate) instead of setting it to `undefined`
60
+ - **Normalized page names**: Page component names [match their route names](/docs/getting-started/upgrade#normalized-page-component-names) for consistent `<KeepAlive>` behavior
61
+ - **Serializable page meta**: Statically analysable `definePageMeta` values are [written into the generated route record](/docs/getting-started/upgrade#serializable-page-meta-extracted-at-build-time)
62
+ - **Client-side payload extraction**: [`experimental.payloadExtraction`](/docs/getting-started/upgrade#payload-extraction-defaults-to-client) is `'client'`, inlining the payload in the HTML of a prerendered page
63
+ - **`clearNuxtState` resets to defaults**: `clearNuxtState` [resets state to its initial value](/docs/getting-started/upgrade#respect-defaults-when-clearing-usestate) instead of setting it to `undefined`
64
+ - **Early return from `navigateTo`**: A successful top-level `await navigateTo()` [stops the rest of your `setup()` running](/docs/getting-started/upgrade#early-return-from-navigateto)
65
65
  - **Non-async `callHook`**: [`callHook` may return `void`](/docs/getting-started/upgrade#non-async-callhook) instead of always returning a `Promise`
66
66
  - **Comment node placeholders**: Client-only components use [comment nodes instead of `<div>`](/docs/getting-started/upgrade#client-only-comment-placeholders) as SSR placeholders, fixing a scoped styles hydration issue
67
- - **Stricter side-effect imports**: The generated `tsconfig.json` enables [`noUncheckedSideEffectImports`](/docs/getting-started/upgrade#stricter-side-effect-imports) to match the TypeScript 7 default
67
+ - **Server auto-imports off**: Server code [imports Nitro's helpers explicitly](/docs/getting-started/upgrade#server-auto-imports-are-now-opt-in) rather than relying on the auto-import layer
68
+ - **Parsed `error.data`**: [`experimental.parseErrorData`](/docs/getting-started/upgrade#experimentalparseerrordata-is-no-longer-configurable) is forced on, so `error.data` reaches the error page unstringified
69
+ - **Builder file watcher**: Nuxt [reuses the builder's own watcher](/docs/getting-started/upgrade#builder-file-watcher-in-development) in development instead of starting a second one
70
+ - **Server-only head composables**: `useServerHead`, `useServerHeadSafe` and `useServerSeoMeta` are [no longer auto-imported](/docs/getting-started/upgrade#server-only-head-composables-are-no-longer-auto-imported), and `unhead.legacy` is ignored
68
71
  - **Vue Options API disabled**: The [Options API is compiled out of the client bundle](/docs/getting-started/upgrade#vue-options-api-disabled-by-default) to reduce its size
69
- - **`process.*` type augmentation removed**: TypeScript no longer exposes [deprecated `process.*` flags](/docs/getting-started/upgrade#process-type-augmentation-removed) on `NodeJS.Process`
70
72
  - **Typed pages**: [`experimental.typedPages`](/docs/getting-started/upgrade#typed-pages-enabled-by-default) is enabled by default for type-checked routing
73
+ - **Node-resolution config types**: The generated `node` tsconfig describes [how the runtime loads `nuxt.config` and modules](/docs/getting-started/upgrade#jiti-is-no-longer-bundled)
74
+ - **Stricter side-effect imports**: The generated `tsconfig.json` enables [`noUncheckedSideEffectImports`](/docs/getting-started/upgrade#stricter-side-effect-imports) to match the TypeScript 7 default
71
75
  - **TypeScript `baseUrl` ignored**: Generated TypeScript configurations [no longer use `compilerOptions.baseUrl`](/docs/getting-started/upgrade#typescript-baseurl-is-ignored) to resolve Nuxt aliases
72
- - Other Nuxt 5 improvements and changes as they become available
76
+ - **PostCSS plugins**: `autoprefixer` and `cssnano` are [no longer installed or configured by default](/docs/getting-started/upgrade#postcss-plugins-are-no-longer-installed-by-default)
77
+ - **Optional dependencies**: [`@vitejs/plugin-vue-jsx`](/docs/getting-started/upgrade#vitejsplugin-vue-jsx-is-now-optional) and [`giget`](/docs/getting-started/upgrade#giget-is-now-optional-remote-layers) are installed on demand
78
+ - **Removed options**: [Several experimental options](/docs/getting-started/upgrade#removed-configuration-options) are gone, because the behaviour they controlled is now unconditional
73
79
 
74
80
  ::note
75
- This section is subject to change until the final release, so please check back here regularly if you are testing Nuxt 5 using `future.compatibilityVersion: 5`.
81
+ Nuxt 5 is still in development, so this page changes as further work lands. Check back here regularly while you are migrating.
76
82
  ::
77
83
 
78
- Breaking or significant changes will be noted below along with migration steps for backward/forward compatibility.
84
+ Breaking or significant changes are documented below along with migration steps and the configuration available for each.
79
85
 
80
86
  ### `process.*` Type Augmentation Removed
81
87
 
@@ -112,7 +118,7 @@ The [`nuxt/prefer-import-meta`](https://eslint.nuxt.com/packages/plugin#nuxtpref
112
118
 
113
119
  #### What Changed
114
120
 
115
- With `compatibilityVersion: 5`, page routes match URLs case-sensitively, consistent with Nitro. For example, `/About` no longer matches `pages/about.vue`.
121
+ `router.options.sensitive` now defaults to `true`, so page routes match URLs case-sensitively, consistent with Nitro. For example, `/About` no longer matches `pages/about.vue`.
116
122
 
117
123
  #### Migration Steps
118
124
 
@@ -128,6 +134,136 @@ export default defineNuxtConfig({
128
134
  })
129
135
  ```
130
136
 
137
+ ### Normalized Page Component Names
138
+
139
+ 🚦 **Impact Level**: Minimal
140
+
141
+ #### What Changed
142
+
143
+ `experimental.normalizePageNames` is now enabled by default, so page components are named after their route rather than after their filename. `pages/foo/index.vue` and `pages/bar/index.vue` are named `foo` and `bar` instead of both being named `index`.
144
+
145
+ #### Migration Steps
146
+
147
+ If you filter `<KeepAlive>` by component name, update `include`/`exclude` to the route names. To keep the filename-based names:
148
+
149
+ ```ts twoslash [nuxt.config.ts]
150
+ export default defineNuxtConfig({
151
+ experimental: {
152
+ normalizePageNames: false,
153
+ },
154
+ })
155
+ ```
156
+
157
+ ### Serializable Page Meta Extracted at Build Time
158
+
159
+ 🚦 **Impact Level**: Minimal
160
+
161
+ #### What Changed
162
+
163
+ `experimental.extractSerializablePageMeta` is now enabled by default. Every JSON-serializable `definePageMeta()` property is written into the generated route record, rather than only a fixed list of keys (plus `experimental.extraPageMetaExtractionKeys`) with the rest resolved at runtime from a per-page meta module.
164
+
165
+ Properties whose values cannot be serialized, such as functions, variable references and spreads, are still resolved at runtime.
166
+
167
+ #### Migration Steps
168
+
169
+ If you read page meta from the route record at build time (in a `pages:extend` hook, for example), expect to see the extracted values there. To keep the previous behaviour:
170
+
171
+ ```ts twoslash [nuxt.config.ts]
172
+ export default defineNuxtConfig({
173
+ experimental: {
174
+ extractSerializablePageMeta: false,
175
+ },
176
+ })
177
+ ```
178
+
179
+ ### Payload Extraction Defaults to `'client'`
180
+
181
+ 🚦 **Impact Level**: Minimal
182
+
183
+ #### What Changed
184
+
185
+ `experimental.payloadExtraction` now defaults to `'client'` rather than `true`. The payload of a prerendered or cached page is inlined in the HTML for the initial render, and the `_payload.json` file is only fetched for client-side navigation. It is still forced to `false` when `ssr` is disabled.
186
+
187
+ #### Migration Steps
188
+
189
+ No change is needed for most applications. If you fetch `_payload.json` for the initial render yourself, or measure HTML size in a test, set the option explicitly:
190
+
191
+ ```ts twoslash [nuxt.config.ts]
192
+ export default defineNuxtConfig({
193
+ experimental: {
194
+ payloadExtraction: true,
195
+ },
196
+ })
197
+ ```
198
+
199
+ ::read-more{to="/docs/getting-started/prerendering#payload-extraction"}
200
+ Read more about payload extraction and the consequences of each mode.
201
+ ::
202
+
203
+ ### Respect Defaults When Clearing `useState`
204
+
205
+ 🚦 **Impact Level**: Minimal
206
+
207
+ #### What Changed
208
+
209
+ `experimental.defaults.useState.resetOnClear` is now enabled by default, so [`clearNuxtState`](/docs/api/utils/clear-nuxt-state) resets state to the value produced by the `init` function of [`useState`](/docs/api/composables/use-state) instead of setting it to `undefined`.
210
+
211
+ #### Migration Steps
212
+
213
+ If your code checks for `undefined` after clearing state, check for the initial value instead. To keep the previous behaviour:
214
+
215
+ ```ts twoslash [nuxt.config.ts]
216
+ export default defineNuxtConfig({
217
+ experimental: {
218
+ defaults: {
219
+ useState: {
220
+ resetOnClear: false,
221
+ },
222
+ },
223
+ },
224
+ })
225
+ ```
226
+
227
+ ### Early Return From `navigateTo`
228
+
229
+ 🚦 **Impact Level**: Minimal
230
+
231
+ #### What Changed
232
+
233
+ `experimental.navigateToEarlyReturn` is now enabled by default. A top-level `await navigateTo()` in `<script setup>` is compiled into an early return from `setup()` when the navigation succeeds, so the rest of the setup code does not run and the component renders a placeholder comment while the navigation proceeds.
234
+
235
+ #### Migration Steps
236
+
237
+ If you relied on code after a successful `await navigateTo()` running, move it before the navigation. To keep the previous behaviour:
238
+
239
+ ```ts twoslash [nuxt.config.ts]
240
+ export default defineNuxtConfig({
241
+ experimental: {
242
+ navigateToEarlyReturn: false,
243
+ },
244
+ })
245
+ ```
246
+
247
+ ### Builder File Watcher in Development
248
+
249
+ 🚦 **Impact Level**: Minimal
250
+
251
+ #### What Changed
252
+
253
+ `experimental.watcher` now defaults to `'builder'`, so Nuxt reuses the active builder's file watcher (Vite's `server.watcher`, for example) instead of starting a second one. If the builder provides no watcher, Nuxt falls back to its previous selection.
254
+
255
+ #### Migration Steps
256
+
257
+ If you depend on watching files the builder ignores, name a watcher explicitly:
258
+
259
+ ```ts twoslash [nuxt.config.ts]
260
+ export default defineNuxtConfig({
261
+ experimental: {
262
+ watcher: 'chokidar',
263
+ },
264
+ })
265
+ ```
266
+
131
267
  ### `jiti` Is No Longer Bundled
132
268
 
133
269
  🚦 **Impact Level**: Medium
@@ -136,7 +272,7 @@ export default defineNuxtConfig({
136
272
 
137
273
  Nuxt no longer depends on [`jiti`](https://github.com/unjs/jiti). Files loaded outside the bundler (`nuxt.config.ts`, files in `modules/`, and layer configs) are now imported by the runtime itself.
138
274
 
139
- **You can still write your config in TypeScript.** Nuxt 5 requires Node `22.19` or later, where type stripping is on by default, so `nuxt.config.ts` and TypeScript modules load natively. Two things the runtime does not do, which `jiti` used to paper over, are guess file extensions and compile TypeScript syntax that emits code.
275
+ **You can still write your config in TypeScript.** Nuxt 5 requires Node `22.19`, `24.11` or later, where type stripping is on by default, so `nuxt.config.ts` and TypeScript modules load natively. Two things the runtime does not do, which `jiti` used to paper over, are guess file extensions and compile TypeScript syntax that emits code.
140
276
 
141
277
  Both would otherwise only surface when Nuxt loads the file, so the generated `node` tsconfig now describes the environment the way the runtime sees it (`module` and `moduleResolution` set to `nodenext`, plus [`erasableSyntaxOnly`](https://www.typescriptlang.org/tsconfig/#erasableSyntaxOnly)) and TypeScript reports both up front.
142
278
 
@@ -340,7 +476,7 @@ Learn more about Vite's Environment API
340
476
  Nuxt 5 upgrades from Vite 7 to [Vite 8](https://main.vite.dev/guide/migration), which replaces esbuild and Rollup with [Rolldown](https://rolldown.rs) as the underlying bundler. This brings significantly faster builds but includes several breaking changes.
341
477
 
342
478
  ::note
343
- Unlike the Vite Environment API migration, this change cannot be opted into early with `future.compatibilityVersion: 5`. If you want to test Vite 8 compatibility ahead of time, you can add a `"vite": "^8.0.0-beta.15"` resolution override in your `package.json`.
479
+ There is no switch for this: Nuxt 5 requires Vite 8. If you want to test Vite 8 compatibility on Nuxt 4 first, you can add a `"vite": "^8.3.0"` resolution override in your `package.json`.
344
480
  ::
345
481
 
346
482
  Most of the migration is handled by Nuxt internally, but there are some user-facing changes to be aware of:
@@ -353,6 +489,30 @@ Most of the migration is handled by Nuxt internally, but there are some user-fac
353
489
  See the full Vite 8 migration guide for all breaking changes and migration steps.
354
490
  ::
355
491
 
492
+ ### Nitro Builds as a Vite Environment
493
+
494
+ 🚦 **Impact Level**: Medium
495
+
496
+ #### What Changed
497
+
498
+ With `@nuxt/vite-builder`, `experimental.nitroViteEnvironment` now defaults to `true`, so Nitro is built as a [Vite environment](https://vite.dev/guide/api-environment) through the `nitro/vite` plugin rather than through Nitro's own Rolldown pipeline. Server and client are built by one Vite build, and server code goes through the Vite plugins and resolution your app code already uses.
499
+
500
+ The option has no effect with other app builders, which keep Nitro's own pipeline. Setting it to `true` there logs a warning.
501
+
502
+ #### Migration Steps
503
+
504
+ Modules that configure Nitro's bundler directly (through `nitro.rollupConfig`, for example) reach a pipeline that no longer runs the server build. Register a Vite plugin instead, scoped with `applyToEnvironment`.
505
+
506
+ To keep Nitro's own build pass:
507
+
508
+ ```ts twoslash [nuxt.config.ts]
509
+ export default defineNuxtConfig({
510
+ experimental: {
511
+ nitroViteEnvironment: false,
512
+ },
513
+ })
514
+ ```
515
+
356
516
  ### Server Imports Move to `nuxt/server`
357
517
 
358
518
  🚦 **Impact Level**: Medium
@@ -388,7 +548,7 @@ Server auto-imports resolve to `nuxt/server` too, so a project that leaves them
388
548
 
389
549
  #### Migration Steps
390
550
 
391
- 1. Replace `nitro/h3` and `@nuxt/nitro-server/h3` imports with `nuxt/server`, for the utilities in [the surface](/docs/guide/going-further/server-imports#the-surface).
551
+ 1. Replace `nitro/h3` and `@nuxt/nitro-server/h3` imports with `nuxt/server`, for the utilities in [the surface](/docs/guide/going-further/server-imports#types-and-utilities).
392
552
  2. Leave the rest on `nitro/h3`. `nuxt/server` is not a re-export of h3, so helpers such as `readValidatedBody` and `handleCors` stay where they are.
393
553
  3. Nothing you reach off `event` has to change: under the default Nitro builder it is still h3's `H3Event`.
394
554
 
@@ -740,15 +900,45 @@ If you previously set `experimental.externalVue` explicitly, you should now remo
740
900
  If you use `vue.runtimeCompiler: true`, the real compiler packages are still included as before.
741
901
  ::
742
902
 
743
- ### `experimental.parseErrorData` Is No Longer Configurable
903
+ ### Server-Only Head Composables Are No Longer Auto-Imported
744
904
 
745
905
  🚦 **Impact Level**: Minimal
746
906
 
747
907
  #### What Changed
748
908
 
749
- The `experimental.parseErrorData` option is deprecated, and on Nuxt 5 it is forced on. Setting it to `false` logs a warning and is otherwise ignored, so `error.data` on the error page is always the value you passed to `createError`.
909
+ `useServerHead`, `useServerHeadSafe` and `useServerSeoMeta` are removed from Nuxt's auto-imports. They are still exported from `#app`, so an explicit import keeps working.
910
+
911
+ The `unhead.legacy` option is ignored on Nuxt 5: setting it logs a warning. Unhead's legacy plugins (`DeprecationsPlugin`, `PromisesPlugin`, `AliasSortingPlugin`) are no longer registered, and Capo sorting is always on. `TemplateParamsPlugin` is still registered, so `%s`, `%siteName` and `%separator` title interpolation is unaffected.
750
912
 
751
- On `compatibilityVersion: 4` the option still works and `false` still gives you a stringified `error.data`, so the behaviour only changes when you opt in to Nuxt 5.
913
+ Tree-shaking of server-only head composables out of the client bundle is handled by the `@unhead/vue/vite` plugin, which Nuxt registers when using `@nuxt/vite-builder`.
914
+
915
+ #### Migration Steps
916
+
917
+ Wrap a `useHead` call in `import.meta.server` instead, or import the composable explicitly:
918
+
919
+ ```diff
920
+ + import { useServerHead } from '#app'
921
+ +
922
+ useServerHead({ meta: [{ name: 'generator', content: 'Nuxt' }] })
923
+ ```
924
+
925
+ Remove `unhead.legacy` from your configuration:
926
+
927
+ ```diff
928
+ export default defineNuxtConfig({
929
+ - unhead: {
930
+ - legacy: true,
931
+ - },
932
+ })
933
+ ```
934
+
935
+ ### `experimental.parseErrorData` Is No Longer Configurable
936
+
937
+ 🚦 **Impact Level**: Minimal
938
+
939
+ #### What Changed
940
+
941
+ The `experimental.parseErrorData` option is deprecated and forced on. Setting it to `false` logs a warning and is otherwise ignored, so `error.data` on the error page is always the value you passed to `createError`. There is no switch for this.
752
942
 
753
943
  #### Reasons for Change
754
944
 
@@ -783,6 +973,34 @@ If you set it to `false` in order to keep parsing `error.data` yourself, drop th
783
973
  </script>
784
974
  ```
785
975
 
976
+ ### Removed Configuration Options
977
+
978
+ 🚦 **Impact Level**: Minimal
979
+
980
+ #### What Changed
981
+
982
+ Three experimental options are removed, because the behaviour they controlled is now unconditional in Nuxt 5:
983
+
984
+ - `experimental.viteEnvironmentApi`. See [Migration to Vite Environment API](#migration-to-vite-environment-api).
985
+ - `experimental.routeTypedFetch`. See [Typed `$fetch` Rebuilt on Generated Route Types](#typed-fetch-rebuilt-on-generated-route-types).
986
+ - `experimental.renderJsonPayloads`. Payloads are always rendered and parsed as JSON, with support for revivers.
987
+
988
+ `experimental.externalVue` is removed too, which is covered in [its own section](#removal-of-experimentalexternalvue).
989
+
990
+ #### Migration Steps
991
+
992
+ Remove the options from your configuration:
993
+
994
+ ```diff
995
+ export default defineNuxtConfig({
996
+ experimental: {
997
+ - viteEnvironmentApi: true,
998
+ - routeTypedFetch: true,
999
+ - renderJsonPayloads: true,
1000
+ },
1001
+ })
1002
+ ```
1003
+
786
1004
  ### `@vitejs/plugin-vue-jsx` Is Now Optional
787
1005
 
788
1006
  🚦 **Impact Level**: Minimal
@@ -825,6 +1043,57 @@ Alternatively, Nuxt will prompt you to install it automatically the first time a
825
1043
 
826
1044
  If your project does not use JSX, no changes are needed.
827
1045
 
1046
+ ### PostCSS Plugins Are No Longer Installed by Default
1047
+
1048
+ 🚦 **Impact Level**: Medium
1049
+
1050
+ #### What Changed
1051
+
1052
+ `autoprefixer` and `cssnano` are no longer configured by default, and are no longer dependencies of `@nuxt/vite-builder`. They are optional peer dependencies, applied only when you name them in `postcss.plugins`. Vite minifies CSS as part of the build, so `cssnano` is not needed for that.
1053
+
1054
+ The webpack and rspack builders still configure both, along with `postcss-import` and `postcss-url`.
1055
+
1056
+ #### Reasons for Change
1057
+
1058
+ Both packages were installed for every project to run a pass most projects do not configure, and browser support for the properties `autoprefixer` prefixes has moved on since the default was set.
1059
+
1060
+ #### Migration Steps
1061
+
1062
+ If you need either plugin, install it and enable it explicitly:
1063
+
1064
+ ::code-group{sync="pm"}
1065
+
1066
+ ```bash [npm]
1067
+ npm install -D autoprefixer cssnano
1068
+ ```
1069
+
1070
+ ```bash [yarn]
1071
+ yarn add -D autoprefixer cssnano
1072
+ ```
1073
+
1074
+ ```bash [pnpm]
1075
+ pnpm add -D autoprefixer cssnano
1076
+ ```
1077
+
1078
+ ```bash [bun]
1079
+ bun add -D autoprefixer cssnano
1080
+ ```
1081
+
1082
+ ::
1083
+
1084
+ ```ts twoslash [nuxt.config.ts]
1085
+ export default defineNuxtConfig({
1086
+ postcss: {
1087
+ plugins: {
1088
+ autoprefixer: {},
1089
+ cssnano: {},
1090
+ },
1091
+ },
1092
+ })
1093
+ ```
1094
+
1095
+ If a configured plugin is not installed, Nuxt prompts you to install it and reports the command to run.
1096
+
828
1097
  ### `giget` Is Now Optional (Remote Layers)
829
1098
 
830
1099
  🚦 **Impact Level**: Minimal
@@ -915,7 +1184,7 @@ If you were setting `ssrContext._renderResponse` directly (which was never a pub
915
1184
 
916
1185
  With the upgrade to [hookable v6](https://github.com/unjs/hookable), `callHook` may now return `void` instead of always returning `Promise<void>`. This is a significant performance improvement that avoids unnecessary `Promise` allocations when there are no registered hooks or all hooks are synchronous.
917
1186
 
918
- By default (with `compatibilityVersion: 4`), Nuxt wraps `callHook` with `Promise.resolve()` so that existing `.then()` and `.catch()` chaining continues to work. With `compatibilityVersion: 5`, this wrapper is removed.
1187
+ Nuxt 4 wrapped `callHook` with `Promise.resolve()` so that existing `.then()` and `.catch()` chaining continued to work. That wrapper is removed, and `experimental.asyncCallHook` now defaults to `false`.
919
1188
 
920
1189
  ::tip
921
1190
  This affects both build-time Nuxt hooks (used by Nuxt modules) and runtime Nuxt hooks (which you might use in your application code).
@@ -939,11 +1208,7 @@ If you or your modules use `callHook` with `.then()` or `.catch()` chaining, swi
939
1208
  + try { await nuxtApp.hooks.callHook('my:hook', data) } catch (err) { ... }
940
1209
  ```
941
1210
 
942
- ::tip
943
- You can test this feature early by setting `future.compatibilityVersion: 5` (see [Testing Nuxt 5](/docs/getting-started/upgrade#testing-nuxt-5)) or by enabling it explicitly with `experimental.asyncCallHook: false`.
944
- ::
945
-
946
- Alternatively, you can ensure `callHook` always returns a `Promise` with:
1211
+ To keep `callHook` always returning a `Promise`:
947
1212
 
948
1213
  ```ts twoslash [nuxt.config.ts]
949
1214
  export default defineNuxtConfig({
@@ -959,7 +1224,7 @@ export default defineNuxtConfig({
959
1224
 
960
1225
  #### What Changed
961
1226
 
962
- With `compatibilityVersion: 5`, client-only components (`.client.vue` files and `createClientOnly()` wrappers) now render an HTML comment (`<!--placeholder-->`) on the server instead of an empty `<div>` element.
1227
+ Client-only components (`.client.vue` files and `createClientOnly()` wrappers) now render an HTML comment (`<!--placeholder-->`) on the server instead of an empty `<div>` element.
963
1228
 
964
1229
  #### Reasons for Change
965
1230
 
@@ -979,11 +1244,7 @@ If you rely on the placeholder `<div>` to inherit attributes (`class`, `style`,
979
1244
  + </ClientOnly>
980
1245
  ```
981
1246
 
982
- ::tip
983
- You can test this feature early by setting `future.compatibilityVersion: 5` (see [Testing Nuxt 5](/docs/getting-started/upgrade#testing-nuxt-5)) or by enabling it explicitly with `experimental.clientNodePlaceholder: true`.
984
- ::
985
-
986
- Alternatively, you can revert to the previous `<div>` placeholder behavior with:
1247
+ To revert to the previous `<div>` placeholder behavior:
987
1248
 
988
1249
  ```ts twoslash [nuxt.config.ts]
989
1250
  export default defineNuxtConfig({
@@ -999,7 +1260,7 @@ export default defineNuxtConfig({
999
1260
 
1000
1261
  #### What Changed
1001
1262
 
1002
- With `compatibilityVersion: 5`, Nuxt's generated `tsconfig.json` enables [`noUncheckedSideEffectImports`](https://www.typescriptlang.org/tsconfig/#noUncheckedSideEffectImports). This is a default in TypeScript 7, so adopting it early keeps your project aligned ahead of that upgrade.
1263
+ Nuxt's generated `tsconfig.json` enables [`noUncheckedSideEffectImports`](https://www.typescriptlang.org/tsconfig/#noUncheckedSideEffectImports). This is a default in TypeScript 7, so adopting it early keeps your project aligned ahead of that upgrade.
1003
1264
 
1004
1265
  With this option on, a side-effect-only import (`import './setup'`) that TypeScript cannot resolve to a module is now a type error, whereas it was previously ignored. This only affects type-checking (`nuxt typecheck` and your editor), not runtime behavior.
1005
1266
 
@@ -1039,7 +1300,7 @@ export default defineNuxtConfig({
1039
1300
 
1040
1301
  #### What Changed
1041
1302
 
1042
- With `compatibilityVersion: 5`, Nuxt sets Vue's [`__VUE_OPTIONS_API__`](https://vuejs.org/api/compile-time-flags#VUE_OPTIONS_API) feature flag to `false`, which compiles Vue's Options API runtime out of the client bundle.
1303
+ Nuxt sets Vue's [`__VUE_OPTIONS_API__`](https://vuejs.org/api/compile-time-flags#VUE_OPTIONS_API) feature flag to `false`, which compiles Vue's Options API runtime out of the client bundle.
1043
1304
 
1044
1305
  #### Reasons for Change
1045
1306
 
@@ -1067,7 +1328,7 @@ export default defineNuxtConfig({
1067
1328
 
1068
1329
  #### What Changed
1069
1330
 
1070
- With `compatibilityVersion: 5`, `experimental.typedPages` is enabled by default. Nuxt generates typed route names and paths from your `pages/` directory, so composables like `useRoute`, `navigateTo`, `<NuxtLink>` and `router.push` are type-checked against your actual routes.
1331
+ `experimental.typedPages` is now enabled by default. Nuxt generates typed route names and paths from your `pages/` directory, so composables like `useRoute`, `navigateTo`, `<NuxtLink>` and `router.push` are type-checked against your actual routes.
1071
1332
 
1072
1333
  #### Reasons for Change
1073
1334
 
@@ -1077,11 +1338,7 @@ Typed routing catches broken links and stale route names at type-check time rath
1077
1338
 
1078
1339
  If you reference routes that don't exist (for example a typo in a `to` prop, or a route defined dynamically outside the `pages/` directory), type-checking will now error. Fix the reference, or extend the generated route types for routes you add at runtime.
1079
1340
 
1080
- ::tip
1081
- You can test this feature early by setting `future.compatibilityVersion: 5` (see [Testing Nuxt 5](/docs/getting-started/upgrade#testing-nuxt-5)) or by enabling it explicitly with `experimental.typedPages: true`.
1082
- ::
1083
-
1084
- Alternatively, you can opt out and revert to the previous behavior with:
1341
+ To opt out and revert to the previous behavior:
1085
1342
 
1086
1343
  ```ts twoslash [nuxt.config.ts]
1087
1344
  export default defineNuxtConfig({
@@ -1108,6 +1365,8 @@ Two things follow from this:
1108
1365
  `ServerRoutes` from `@nuxt/schema` instead.
1109
1366
  - The `params` option is no longer accepted by `$fetch` or `useFetch`. It was an alias for `query`.
1110
1367
 
1368
+ A path the generated route types do not describe still resolves, as `unknown`, unless you opt in to [`experimental.strictRouteTypes`](/docs/guide/going-further/experimental-features#strictroutetypes).
1369
+
1111
1370
  #### Reasons for Change
1112
1371
 
1113
1372
  Nitro v3 dropped typed fetch, and the old implementation did not scale past about 300 routes. The new
@@ -1157,7 +1416,7 @@ Read more about typed routes.
1157
1416
 
1158
1417
  #### What Changed
1159
1418
 
1160
- With `compatibilityVersion: 5`, Nuxt removes `compilerOptions.baseUrl` from its generated TypeScript configurations. Relative Nuxt and Nitro aliases are resolved from Nuxt's build directory instead of a custom `baseUrl`.
1419
+ Nuxt removes `compilerOptions.baseUrl` from its generated TypeScript configurations. Relative Nuxt and Nitro aliases are resolved from Nuxt's build directory instead of a custom `baseUrl`.
1161
1420
 
1162
1421
  #### Reasons for Change
1163
1422
 
@@ -99,7 +99,7 @@ There is also a `future` namespace for early opting-in to new features that will
99
99
 
100
100
  This enables early access to Nuxt features or flags.
101
101
 
102
- Setting `compatibilityVersion` to `5` changes defaults throughout your Nuxt configuration to opt in to Nuxt v5 behaviour, including enabling the [Vite Environment API](/docs/guide/going-further/experimental-features#viteenvironmentapi).
102
+ On Nuxt 5 it resolves to `5`, and the defaults described in the upgrade guide apply. Individual changes are configured through the options named there rather than through this one.
103
103
 
104
104
  ```ts
105
105
  export default defineNuxtConfig({
@@ -109,8 +109,8 @@ export default defineNuxtConfig({
109
109
  })
110
110
  ```
111
111
 
112
- ::read-more{to="/docs/getting-started/upgrade#testing-nuxt-5"}
113
- Learn more about testing Nuxt 5.
112
+ ::read-more{to="/docs/getting-started/upgrade#migrating-to-nuxt-5"}
113
+ Learn more about migrating to Nuxt 5.
114
114
  ::
115
115
 
116
116
  ### multiApp
@@ -35,6 +35,8 @@ Public runtime config is accessible in Vue templates with `$config.public`.
35
35
 
36
36
  ### Application Secret
37
37
 
38
+ Runtime config keys prefixed with `app` are reserved for Nuxt (currently `runtimeConfig.app` and `runtimeConfig.appSecret`). Do not use them for your own values.
39
+
38
40
  Nuxt provides a private `runtimeConfig.appSecret` as the application's root secret. Modules and server features derive their own secrets from it with [`deriveSecret`](/docs/guide/going-further/server-imports#deriving-secrets), and the [session helpers](/docs/guide/going-further/server-imports#sessions) seal with one by default. The value defaults to an empty string, is only available on the server, and you can set it with `NUXT_APP_SECRET` without declaring the key in `nuxt.config`.
39
41
 
40
42
  Generate a secret that contains at least 32 random bytes:
@@ -47,7 +49,7 @@ openssl rand -base64 32
47
49
  Use a different value for each environment, but keep it stable across deployments and server instances within that environment. Changing the value invalidates any sessions or signatures that depend on it.
48
50
  ::
49
51
 
50
- In development, Nuxt generates a random secret and stores it in `.nuxt/app-secret` when `NUXT_APP_SECRET` is unset or shorter than 32 characters, so features that depend on it work without any setup. Builds never generate one: set `NUXT_APP_SECRET` in every environment you deploy to.
52
+ In development, Nuxt generates a random secret and stores it in `.nuxt/app-secret` only when `appSecret` is unset, so features that depend on it work without any setup. A configured value is always used as is. Nuxt logs a warning the first time a derived secret is used with the generated value. Builds never generate one: set `NUXT_APP_SECRET` in every environment you deploy to.
51
53
 
52
54
  Nuxt does not require `NUXT_APP_SECRET` unless a module or server feature uses it.
53
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/docs-nightly",
3
- "version": "5.0.0-29835892.99af6dec",
3
+ "version": "5.0.0-29836693.3006e5ac",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",