fix(nuxt): add pages in correct hook when generating (#22088)

This commit is contained in:
Daniel Roe 2023-07-12 08:26:52 +01:00 committed by GitHub
parent dcef9d94cd
commit e9dac76348
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -205,7 +205,6 @@ export default defineNuxtModule({
if (nuxt.options.dev || !nitro.options.static) { return } if (nuxt.options.dev || !nitro.options.static) { return }
// Prerender all non-dynamic page routes when generating app // Prerender all non-dynamic page routes when generating app
const prerenderRoutes = new Set<string>() const prerenderRoutes = new Set<string>()
nuxt.hook('modules:done', () => {
nuxt.hook('pages:extend', (pages) => { nuxt.hook('pages:extend', (pages) => {
prerenderRoutes.clear() prerenderRoutes.clear()
const processPages = (pages: NuxtPage[], currentPath = '/') => { const processPages = (pages: NuxtPage[], currentPath = '/') => {
@ -221,7 +220,6 @@ export default defineNuxtModule({
} }
processPages(pages) processPages(pages)
}) })
})
nuxt.hook('nitro:build:before', (nitro) => { nuxt.hook('nitro:build:before', (nitro) => {
for (const route of nitro.options.prerender.routes || []) { for (const route of nitro.options.prerender.routes || []) {
// Skip default route value as we only generate it if it is already // Skip default route value as we only generate it if it is already