Skip to content

Commit 217cb57

Browse files
committed
Add basename support to RSC Framework Mode
1 parent 795b50c commit 217cb57

File tree

8 files changed

+468
-343
lines changed

8 files changed

+468
-343
lines changed

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/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)