Skip to content

Commit

Permalink
fix: use experimental pages:resolved hook if enabled (#3196)
Browse files Browse the repository at this point in the history
* fix: use experimental `pages:resolved` hook if enabled

* fix: linting and type errors
  • Loading branch information
BobbieGoede authored Nov 1, 2024
1 parent cff8ccd commit 11b3edc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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: [],
Expand Down

0 comments on commit 11b3edc

Please sign in to comment.