React Router 7 fails on build

Hey!

I am following the guide found at: How to deploy a React Router 7 site to Netlify | Netlify Developers

Everything seems fine, until I am hitting this error:

12:50:11 PM: (build.command completed in 10.3s)
12:50:11 PM: ​
12:50:11 PM: Functions bundling                                            
12:50:11 PM: ─────────────
12:50:11 PM: ​
12:50:11 PM: Packaging Functions generated by your framework:
12:50:11 PM:  - react-router-server.mjs
12:50:11 PM: ​
12:50:11 PM: ✘ [ERROR] Could not resolve "../../../build/server/server.js"
12:50:11 PM:     .netlify/v1/functions/react-router-server.mjs:2:28:
12:50:11 PM:       2 │     export { default } from "../../../build/server/server.js";

The directory ./build/server is created, but with index.js inside, not with server.js.

I never used any cloud functions on Netlify, so I don’t know how to debug it.
Sitename: buszewskiv2.netlify.app (never deployed due to the issue).


I can’t paste the full log due to posting limitations.

Just wanted to say that I made it working by changing netlify.toml’s build command to command = "react-router build && cp build/server/index.js build/server/server.js". Feels like an extreme hack though.

Do you have a minimal reproduction available to share?

Nope, sorry, that’s private repo for now. But it’s react-router 7.1.1 with a pretty standard config, so I don’t think you’ll have different results with a clean rr7 install.

Feel free to share a repo with a clearn RR7 install and I’ll be happy to check that.