diff --git a/src/pages.ts b/src/pages.ts index d16ff7fc1..2bfcb1189 100644 --- a/src/pages.ts +++ b/src/pages.ts @@ -1,5 +1,5 @@ import createDebug from 'debug' -import { addTemplate, extendPages } from '@nuxt/kit' +import { addTemplate } from '@nuxt/kit' import { isString } from '@intlify/shared' import { parse as parseSFC, compileScript } from '@vue/compiler-sfc' import { walk } from 'estree-walker' @@ -54,7 +54,13 @@ export async function setupPages({ localeCodes, options, isSSR }: I18nNuxtContex const typedRouter = await setupExperimentalTypedRoutes(options, nuxt) - extendPages(async pages => { + // @ts-expect-error needs nuxt 3.14.0 + const pagesHook: Parameters<(typeof nuxt)['hook']>[0] = + // @ts-expect-error needs nuxt 3.14.0 + nuxt.options.experimental.scanPageMeta === 'after-resolve' ? 'pages:resolved' : 'pages:extend' + + // TODO: remove with the release of 3.14.0 + nuxt.hook(pagesHook as 'pages:extend', async pages => { debug('pages making ...', pages) const ctx: NuxtPageAnalyzeContext = { stack: [],