mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-16 10:54:49 +00:00
14 lines
350 B
TypeScript
14 lines
350 B
TypeScript
import type { NuxtHooks } from '@nuxt/schema'
|
|
import { useNuxt } from './context'
|
|
import { isNuxt2 } from './compatibility'
|
|
|
|
export function extendPages (cb: NuxtHooks['pages:extend']) {
|
|
const nuxt = useNuxt()
|
|
if (isNuxt2(nuxt)) {
|
|
// @ts-expect-error
|
|
nuxt.hook('build:extendRoutes', cb)
|
|
} else {
|
|
nuxt.hook('pages:extend', cb)
|
|
}
|
|
}
|