TanStackT
TanStack3mo ago
4 replies
awake-maroon

Prerender not working when using TanStack Start with Nitro v2 plugin

Hi, I’m trying to prerender pages using tanstack-start + Nitro v2 plugin, but prerendering doesn’t generate any static output.

Here’s my vite.config.ts:
// vite.config.ts
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
import tsConfigPaths from "vite-tsconfig-paths"
import tailwindcss from "@tailwindcss/vite"
import { tanstackStart } from "@tanstack/react-start/plugin/vite"
import nitroV2Plugin from "@tanstack/nitro-v2-vite-plugin"

export default defineConfig(async () => ({
  plugins: [    
    tailwindcss(),
    tsConfigPaths({
      projects: ["./tsconfig.json"],
    }),
    tanstackStart(),
    nitroV2Plugin({
      prerender: {
        routes: ["/docs"], // expecting static output for /docs
      },
    }),
    react(),
  ],
}))


Expected: Nitro prerenders /docs into a static HTML file.
Actual: The build finishes successfully, but only the server output is generated (.output/server). No prerendered HTML files are created.

Has anyone successfully used prerendering with Nitro v2 + tanstack-start?
Any hints would be appreciated. 🙏
Was this page helpful?