Nuxt/test/fixtures/basic/modules/page-extend.ts
Daniel Roe 566fa85fc8
fix(nuxt): run page meta plugin on all pages (and only pages) (#20628)
Co-authored-by: Julien Huang <julien.huang@outlook.fr>
2023-05-03 15:14:12 +01:00

20 lines
434 B
TypeScript

import { createResolver, defineNuxtModule, useNuxt } from 'nuxt/kit'
export default defineNuxtModule({
meta: {
name: 'page-extend'
},
setup () {
const nuxt = useNuxt()
const resolver = createResolver(import.meta.url)
nuxt.hook('pages:extend', (pages) => {
pages.push({
name: 'page-extend',
path: '/page-extend',
file: resolver.resolve('./runtime/page.vue')
})
})
}
})