Cannot use base name of /app/
I'm using React Router as a...
framework
Reproduction
Hello I am beginning to migrate from a react-router-dom project into react-router v7 SPA mode, and running into an issue with the basename. It cannot be set to "/app/". Other values seem to work. This seems to have been an issue in remix v2 (https://github.com/remix-run/remix/issues/9382)
Reproduction stackblitz: https://stackblitz.com/edit/github-cwx9niwt?file=react-router.config.ts
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Max
Memory: 778.33 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.2.0 - /opt/homebrew/bin/node
npm: 10.7.0 - /opt/homebrew/bin/npm
pnpm: 9.14.2 - /opt/homebrew/bin/pnpm
Watchman: 2024.06.17.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 136.0.7103.114
Safari: 18.5
npmPackages:
@react-router/dev: ^7.5.3 => 7.6.1
@react-router/node: ^7.5.3 => 7.6.1
@react-router/serve: ^7.5.3 => 7.6.1
react-router: ^7.5.3 => 7.6.1
vite: ^6.3.3 => 6.3.5
Used Package Manager
npm
Expected Behavior
The application will work!
Actual Behavior
Failed to load url /root.tsx (resolved id: /root.tsx) in virtual:react-router/server-build. Does the file exist?
Any update on this.
currently, the basename and the physical folder of the source code cannot be the same
just rename the app folder to src
and specify where your appDirectory is in the react-router config
forked and updated your example to show it working
https://stackblitz.com/edit/github-cwx9niwt-xzdmgzgz?file=react-router.config.ts
Let me know if that achieves your goal