Skip to content

Commit 6133e51

Browse files
Add basename support to RSC Framework Mode (#14264)
1 parent 074530d commit 6133e51

File tree

16 files changed

+500
-370
lines changed

16 files changed

+500
-370
lines changed

.changeset/flat-shoes-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-router": patch
3+
---
4+
5+
In RSC Data Mode when using a custom basename, fix hydration errors for routes that only have client loaders

integration/helpers/rsc-vite-framework/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@vanilla-extract/css": "^1.17.4",
2222
"@vanilla-extract/vite-plugin": "^5.1.1",
2323
"@vitejs/plugin-react": "^4.5.2",
24-
"@vitejs/plugin-rsc": "0.4.25",
24+
"@vitejs/plugin-rsc": "0.4.26",
2525
"cross-env": "^7.0.3",
2626
"typescript": "^5.1.6",
2727
"vite": "^6.2.0",

integration/helpers/rsc-vite-framework/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import reactRouterRequestHandler from "./build/server/index.js";
44

55
const app = express();
66

7-
app.use(express.static("build/client"));
7+
app.use(process.env.VITE_BASE || "/", express.static("build/client"));
88

99
app.get("/.well-known/appspecific/com.chrome.devtools.json", (_, res) => {
1010
res.status(404);

integration/helpers/rsc-vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"typecheck": "tsc"
1111
},
1212
"devDependencies": {
13-
"@vitejs/plugin-rsc": "0.4.25",
13+
"@vitejs/plugin-rsc": "0.4.26",
1414
"@types/express": "^5.0.0",
1515
"@types/node": "^22.13.1",
1616
"@types/react": "^19.1.8",

integration/helpers/vite.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,17 +337,23 @@ export const reactRouterServe = async ({
337337
export const runStartScript = async ({
338338
cwd,
339339
port,
340+
viteBase,
340341
basename,
341342
}: {
342343
cwd: string;
343344
port: number;
345+
viteBase?: string;
344346
basename?: string;
345347
}) => {
346348
let nodeBin = process.argv[0];
347349
let proc = spawn(nodeBin, ["start.js"], {
348350
cwd,
349351
stdio: "pipe",
350-
env: { NODE_ENV: "production", PORT: port.toFixed(0) },
352+
env: {
353+
NODE_ENV: "production",
354+
PORT: port.toFixed(0),
355+
VITE_BASE: viteBase,
356+
},
351357
});
352358
await waitForServer(proc, { port, basename });
353359
return () => proc.kill();

0 commit comments

Comments
 (0)