@nuxt/docs-nightly 5.0.0-29753113.aaeaed06 → 5.0.0-29753131.8b68f17a
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.
|
@@ -67,6 +67,7 @@ When you set your `future.compatibilityVersion` to `5`, defaults throughout your
|
|
|
67
67
|
- **Stricter side-effect imports**: The generated `tsconfig.json` enables [`noUncheckedSideEffectImports`](/docs/4.x/getting-started/upgrade#stricter-side-effect-imports) to match the TypeScript 7 default
|
|
68
68
|
- **Vue Options API disabled**: The [Options API is compiled out of the client bundle](/docs/4.x/getting-started/upgrade#vue-options-api-disabled-by-default) to reduce its size
|
|
69
69
|
- **`process.*` type augmentation removed**: TypeScript no longer exposes [deprecated `process.*` flags](/docs/4.x/getting-started/upgrade#process-type-augmentation-removed) on `NodeJS.Process`
|
|
70
|
+
- **Typed pages**: [`experimental.typedPages`](/docs/4.x/getting-started/upgrade#typed-pages-enabled-by-default) is enabled by default for type-checked routing
|
|
70
71
|
- Other Nuxt 5 improvements and changes as they become available
|
|
71
72
|
|
|
72
73
|
::note
|
|
@@ -647,3 +648,33 @@ export default defineNuxtConfig({
|
|
|
647
648
|
::note
|
|
648
649
|
`defineNuxtComponent` is unaffected: its `asyncData` and `head` options are handled through `setup()` rather than the Vue Options API, so it works regardless of this flag.
|
|
649
650
|
::
|
|
651
|
+
|
|
652
|
+
### Typed Pages Enabled by Default
|
|
653
|
+
|
|
654
|
+
🚦 **Impact Level**: Minimal
|
|
655
|
+
|
|
656
|
+
#### What Changed
|
|
657
|
+
|
|
658
|
+
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.
|
|
659
|
+
|
|
660
|
+
#### Reasons for Change
|
|
661
|
+
|
|
662
|
+
Typed routing catches broken links and stale route names at type-check time rather than at runtime, and it is now native to `vue-router`, so it is a sensible default.
|
|
663
|
+
|
|
664
|
+
#### Migration Steps
|
|
665
|
+
|
|
666
|
+
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.
|
|
667
|
+
|
|
668
|
+
::tip
|
|
669
|
+
You can test this feature early by setting `future.compatibilityVersion: 5` (see [Testing Nuxt 5](/docs/4.x/getting-started/upgrade#testing-nuxt-5)) or by enabling it explicitly with `experimental.typedPages: true`.
|
|
670
|
+
::
|
|
671
|
+
|
|
672
|
+
Alternatively, you can opt out and revert to the previous behavior with:
|
|
673
|
+
|
|
674
|
+
```ts twoslash [nuxt.config.ts]
|
|
675
|
+
export default defineNuxtConfig({
|
|
676
|
+
experimental: {
|
|
677
|
+
typedPages: false,
|
|
678
|
+
},
|
|
679
|
+
})
|
|
680
|
+
```
|