nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3k stars 607 forks source link

nuxt generate crawler fails after nuxt 3.12 #2664

Closed DallasHoff closed 1 day ago

DallasHoff commented 6 days ago

Environment

Reproduction

Repo (disregard the repo name; it's for a different issue)

  1. Run npx nuxi@latest module add content
  2. Run nuxt generate
  3. Observe that .output/public/index.html exists since Nuxt 3.11 is installed
  4. Run npx nuxi@latest upgrade --force to upgrade Nuxt to 3.12
  5. Run nuxt generate again
  6. Observe that .output/public/index.html does not exist

Describe the bug

After upgrading to Nuxt 3.12, nuxt generate outputs no index.html or HTML files for any other pages defined in the pages directory if the Nuxt Content module is installed.

There is no error displayed in the output of nuxt generate. It simply reports that the crawler only found 3 routes: 200.html, 404.html, and /api/_content/cache.1718155374568.json. If @nuxt/content is removed from nuxt.config.ts, nuxt generate will find and render the rest of the pages.

Additional context

No response

Logs

No response

sshwy commented 5 days ago

facing the same issue

farnabaz commented 5 days ago

According to this comment, it is a regression in Nuxt 3.12. https://github.com/nuxt/nuxt/issues/27490#issuecomment-2162890462

Until it fixes in the upstream you can add this route rule into your config.

export default defineNuxtConfig({
  routeRules: {
    '/': {
      prerender: true
    }
  },
})
isaackearl commented 3 days ago

According to this comment, it is a regression in Nuxt 3.12. nuxt/nuxt#27490 (comment)

Until it fixes in the upstream you can add this route rule into your config.

export default defineNuxtConfig({
  routeRules: {
    '/': {
      prerender: true
    }
  },
})

This doesn't work for me unfortunately. If I downgrade to Nuxt 3.11 it renders 19 routes. If I upgrade to Nuxt 3.12 I get 3 but they don't render correctly. If I do it the other way as described in that issue, then I can specify each one explicitly and that seems to work, but it's not ideal (only tested rendering one).

DallasHoff commented 1 day ago

The new 3.12.2 patch of nuxt fixed this.

isaackearl commented 21 hours ago

The new 3.12.2 patch of nuxt fixed this.

This issue is not fixed for me in 3.12.2.

I cannot get all my routes to prerender as they normally do when I generate. I'm running a client side only (ssr: false), project where we always build to production staticly.

Without making any modifications in 3.11 when I run npm run generate, it works great and prerenders 19 routes. the static generation works great etc.. then I upgrade to 3.12.2, and it renders 4 routes, but they only seem to be the default 404 and things like that... none of my actual pages. One note is that our software doesn't have a page at the root "/", as we are using nuxt to replace old legacy pages in an older application. This hasn't been a problem in any previous version of Nuxt.

image

On 3.11 I have 19 initial routes which includes all my actual pages I've created and it doesn't have the / route (which is correct as that route doesn't exist in my project)