mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
docs: add router.extendRoutes
example to migration docs (#4023)
* docs: add `router.extendRoutes` example to migration docs * style: lint
This commit is contained in:
parent
1890c55cbe
commit
59b319b492
@ -13,23 +13,53 @@ Nuxt configuration will be loaded using [`unjs/jiti`](https://github.com/unjs/ji
|
||||
|
||||
### Migration
|
||||
|
||||
You should migrate to the new `defineNuxtConfig` function that provides a typed configuration schema.
|
||||
1. You should migrate to the new `defineNuxtConfig` function that provides a typed configuration schema.
|
||||
|
||||
::code-group
|
||||
::code-group
|
||||
|
||||
```ts [Nuxt 2]
|
||||
export default {
|
||||
```ts [Nuxt 2]
|
||||
export default {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
```ts [Nuxt 3]
|
||||
import { defineNuxtConfig } from 'nuxt3'
|
||||
```ts [Nuxt 3]
|
||||
import { defineNuxtConfig } from 'nuxt3'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
export default defineNuxtConfig({
|
||||
// ...
|
||||
})
|
||||
```
|
||||
})
|
||||
```
|
||||
|
||||
::
|
||||
|
||||
1. If you were using `router.extendRoutes` you can migrate to the new `pages:extend` hook:
|
||||
|
||||
::code-group
|
||||
|
||||
```ts [Nuxt 2]
|
||||
export default {
|
||||
router: {
|
||||
extendRoutes (routes) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```ts [Nuxt 3]
|
||||
import { defineNuxtConfig } from 'nuxt3'
|
||||
|
||||
export default defineNuxtConfig({
|
||||
hooks: {
|
||||
'pages:extend' (routes) {
|
||||
//
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
::
|
||||
|
||||
#### ESM Syntax
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user