React Router 7 Build in SPA mode

Hello and first of all thanks for taking the time to read this post :slight_smile:!

I am working on a React Router 7 app in Framework mode, and configured the project as specified on this how-to.

As I use Three.js on this project, it is Javascript heavy and SPA mode combined with pre-rendering for information pages seemed preferable in this situation.

Each time I try to build my app with ssr: false in my react-router.config.ts, I get the following error at build time (even locally) :
[react-router] Server build file not found in manifest

The log says it is linked to react-router, but It works correctly when I remove netlifyPlugin() from my Vite config or set SSR back to true.

I thought it might come from my config so I tried locally with the template you provide, and same problem happens as soon as I switch SSR to false in the Vite config (tried locally).

I noticed that Edge SSR is not yet supported on the how-to I linked, could this explain why it doesn’t work ? What about the fact it has the same error locally ?

Thank you for your help !

I have a similar issue with, ssr and prerender set in my config

{
ssr: true,
prerender: ["/"]
}

@Toww do you have prerender set too ?

I used to have:

import type { Config } from "@react-router/dev/config";

export default {
  appDirectory: "src",
  ssr: false,
  prerender: ["/about"];
} satisfies Config;

And tried different combinations with async pre-render, ssr true + pre-render, both on my app and on the default template that doesn’t need to specify an appDirectory but the only thing that seems to work for now is setting ssr: true without pre-rendering of any sort.

While trying things I also noticed that when SSR is set to false and I remove netlify plugin from vite config, the build works and RR7 creates a client and a server folder in the build folder. At the end of the build though, it deletes the server folder as it isn’t necessary anymore, as you can see in the build log :

vite v6.3.5 building SSR bundle for production...
✓ 7 modules transformed.
build/server/.vite/manifest.json      0.41 kB
build/server/assets/app-Ckulty-W.css  7.33 kB
build/server/index.js                 6.56 kB
SPA Mode: Generated build/client/index.html
Removing the server build in /home/user/documents/react-router-template/build/server due to ssr:false

Also, if you look at the manifest in a failed build folder with ssr:false and prerender:true + netlify vite plugin activated, the server folder is there and the server.js file + its correct path in the manifest are present :man_shrugging:.

This Github Issue seems related but didn’t find a workaround yet, but it might explain why vite plugin can’t seem to find the server build in manifest.