nuxt / content

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

Upgrade to @nuxt/content 2.13.1 breaks static page generation #2688

Closed Mini-ghost closed 4 days ago

Mini-ghost commented 1 week ago

Environment


Reproduction

N/A

Describe the bug

In @nuxt/content 2.13.0, when I run nuxt generate, it successfully builds all my static pages. However, after upgrading to 2.13.1, it only creates 404.html and 200.html along with other pages related to @nuxtjs/sitemap.

I found this is related to issue #2681. It seems the fix was intended to resolve an issue with nuxt/i18n, but it has disrupted the existing functionality. Is there a better approach? Would it be better to address this issue directly within nuxt/i18n?

Currently, we need to add the following to nuxt.config.ts to continue working as expected:

export default defineNuxtConfig({
  // ...

  nitro: {
    prerender: {
      routes: ['/'],
    },
  },
});

Additional context

No response

Logs

No response

awwaiid commented 1 week ago

I confirm both the problem ('/' not included implicitly) and that adding it explicitly makes it work.

damisparks commented 1 week ago

@Mini-ghost I appreciate you for sharing. I used your workaround.

export default defineNuxtConfig({
  // ...

  nitro: {
    prerender: {
      routes: ['/sitemap.xml', '/'],
    },
  },
});
Skyost commented 6 days ago

Thanks for the workaround guys.

farnabaz commented 6 days ago

This is actually not related to Content module but Nuxt itself. There is a regression in Nuxt which cause removing / from pre-render routes and therefore static generation breaks.

I second on https://github.com/nuxt/content/issues/2688#issuecomment-2214638068, the only workaround for now is to add / into nitro.prerender.routes or routeRules

Mini-ghost commented 6 days ago

@farnabaz Thank you for your explanation. If this is expected by the team, then it’s fine! Should I close this issue?

However, wouldn't it be better to highlight this point in the release log? For users, being able to identify potential issues from the release log could significantly reduce confusion.

farnabaz commented 5 days ago

@Mini-ghost Indeed it would be better if we add a note in docs or releases. This issue supposed to be fixed in latest Nuxt patch but still exists and waiting to be fixed in next patch.

Feel free to close the issue, I'll update release notes to note about regression

Mini-ghost commented 4 days ago

Thank you very much for your work. 🙌