Skip to content

Commit

Permalink
fix(nuxt): add / as fallback if page can't be identified
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jul 3, 2024
1 parent 809fb71 commit e6109b2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/nuxt/src/pages/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 303,9 @@ export default defineNuxtModule({
// Only hint the first route when `ssr: true` and no routes are provided
if (nuxt.options.ssr) {
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()
if (firstPage) {
routes.add(firstPage)
}
routes.add(firstPage || '/')
}
})
return
Expand Down

0 comments on commit e6109b2

Please sign in to comment.