#route rules not work in dev mode?

2 messages · Page 1 of 1 (latest)

amber spireBOT
#

Hi @frank yoke. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources, this is expected behavior. Route rules with prerender: true are designed to work during the build process, not in development mode.

According to the prerendering documentation, when you set prerender: true in route rules, those routes are prerendered at build time and included in your build as static assets. This means:

  • In development mode (nuxt dev): The prerendering doesn't occur because the build process hasn't run yet. Your pages are served with regular SSR.
  • In production (nuxt build + preview): The routes are prerendered during the build, and the static HTML files are served from .output/public/.

However, there is a recent pull request that mentions adding development support for payload extraction with prerender route rules, which suggests some development-mode support may be coming for certain aspects of prerendering.

If you want to test prerendering behavior, you need to:

  1. Run nuxt build or nuxt generate
  2. Preview the built output with npx serve .output/public or similar

This is the intended workflow for testing prerendered routes, as the prerendering process is fundamentally a build-time operation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: