#route rules not work in dev mode?
2 messages · Page 1 of 1 (latest)
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:
- Run
nuxt buildornuxt generate - Preview the built output with
npx serve .output/publicor similar