mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): add /
as fallback if page can't be identified
This commit is contained in:
parent
a8b3bd4b1a
commit
34fd04bb46
@ -308,11 +308,9 @@ export default defineNuxtModule({
|
|||||||
// Only hint the first route when `ssr: true` and no routes are provided
|
// Only hint the first route when `ssr: true` and no routes are provided
|
||||||
if (nuxt.options.ssr) {
|
if (nuxt.options.ssr) {
|
||||||
nitro.hooks.hook('prerender:routes', (routes) => {
|
nitro.hooks.hook('prerender:routes', (routes) => {
|
||||||
if ([...routes].every(r => r.endsWith('.html'))) {
|
if ([...routes].every(r => r.match(/(^\/api|\.\w+)/))) {
|
||||||
const [firstPage] = [...prerenderRoutes].sort()
|
const [firstPage] = [...prerenderRoutes].sort()
|
||||||
if (firstPage) {
|
routes.add(firstPage || '/')
|
||||||
routes.add(firstPage)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user