Skip to content

Commit f14af14

Browse files
committed
fix: vite plugin root directory of prerender
1 parent 698eccf commit f14af14

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@
191191
- ken0x0a
192192
- kentcdodds
193193
- kettanaito
194+
- kigawas
194195
- kilavvy
195196
- kiliman
196197
- kkirsche

packages/react-router-dev/vite/plugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,7 +2661,7 @@ async function handleSpaMode(
26612661

26622662
// Write out the HTML file for the SPA
26632663
await writeFile(path.join(clientBuildDirectory, filename), html);
2664-
let prettyDir = path.relative(process.cwd(), clientBuildDirectory);
2664+
let prettyDir = path.relative(viteConfig.root, clientBuildDirectory);
26652665
let prettyPath = path.join(prettyDir, filename);
26662666
if (build.prerender.length > 0) {
26672667
viteConfig.logger.info(
@@ -2835,7 +2835,7 @@ async function prerenderData(
28352835
}
28362836

28372837
// Write out the .data file
2838-
let outdir = path.relative(process.cwd(), clientBuildDirectory);
2838+
let outdir = path.relative(viteConfig.root, clientBuildDirectory);
28392839
let outfile = path.join(outdir, ...normalizedPath.split("/"));
28402840
await mkdir(path.dirname(outfile), { recursive: true });
28412841
await writeFile(outfile, data);
@@ -2894,7 +2894,7 @@ async function prerenderRoute(
28942894
}
28952895

28962896
// Write out the HTML file
2897-
let outdir = path.relative(process.cwd(), clientBuildDirectory);
2897+
let outdir = path.relative(viteConfig.root, clientBuildDirectory);
28982898
let outfile = path.join(outdir, ...normalizedPath.split("/"), "index.html");
28992899
await mkdir(path.dirname(outfile), { recursive: true });
29002900
await writeFile(outfile, html);
@@ -2927,7 +2927,7 @@ async function prerenderResourceRoute(
29272927
}
29282928

29292929
// Write out the resource route file
2930-
let outdir = path.relative(process.cwd(), clientBuildDirectory);
2930+
let outdir = path.relative(viteConfig.root, clientBuildDirectory);
29312931
let outfile = path.join(outdir, ...normalizedPath.split("/"));
29322932
await mkdir(path.dirname(outfile), { recursive: true });
29332933
await writeFile(outfile, content);

0 commit comments

Comments
 (0)