From 59b319b49238310b742106c88ece1903960bd9e6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 1 Apr 2022 14:21:06 +0100 Subject: [PATCH] docs: add `router.extendRoutes` example to migration docs (#4023) * docs: add `router.extendRoutes` example to migration docs * style: lint --- .../3.docs/3.migration/2.configuration.md | 56 ++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/docs/content/3.docs/3.migration/2.configuration.md b/docs/content/3.docs/3.migration/2.configuration.md index 357f68959a..f534e8a72b 100644 --- a/docs/content/3.docs/3.migration/2.configuration.md +++ b/docs/content/3.docs/3.migration/2.configuration.md @@ -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