@@ -2650,7 +2650,7 @@ async function handleSpaMode(
26502650
26512651 // Write out the HTML file for the SPA
26522652 await fse . writeFile ( path . join ( clientBuildDirectory , filename ) , html ) ;
2653- let prettyDir = path . relative ( process . cwd ( ) , clientBuildDirectory ) ;
2653+ let prettyDir = path . relative ( viteConfig . root , clientBuildDirectory ) ;
26542654 let prettyPath = path . join ( prettyDir , filename ) ;
26552655 if ( build . prerender . length > 0 ) {
26562656 viteConfig . logger . info (
@@ -2824,7 +2824,7 @@ async function prerenderData(
28242824 }
28252825
28262826 // Write out the .data file
2827- let outdir = path . relative ( process . cwd ( ) , clientBuildDirectory ) ;
2827+ let outdir = path . relative ( viteConfig . root , clientBuildDirectory ) ;
28282828 let outfile = path . join ( outdir , ...normalizedPath . split ( "/" ) ) ;
28292829 await fse . ensureDir ( path . dirname ( outfile ) ) ;
28302830 await fse . outputFile ( outfile , data ) ;
@@ -2883,7 +2883,7 @@ async function prerenderRoute(
28832883 }
28842884
28852885 // Write out the HTML file
2886- let outdir = path . relative ( process . cwd ( ) , clientBuildDirectory ) ;
2886+ let outdir = path . relative ( viteConfig . root , clientBuildDirectory ) ;
28872887 let outfile = path . join ( outdir , ...normalizedPath . split ( "/" ) , "index.html" ) ;
28882888 await fse . ensureDir ( path . dirname ( outfile ) ) ;
28892889 await fse . outputFile ( outfile , html ) ;
@@ -2916,7 +2916,7 @@ async function prerenderResourceRoute(
29162916 }
29172917
29182918 // Write out the resource route file
2919- let outdir = path . relative ( process . cwd ( ) , clientBuildDirectory ) ;
2919+ let outdir = path . relative ( viteConfig . root , clientBuildDirectory ) ;
29202920 let outfile = path . join ( outdir , ...normalizedPath . split ( "/" ) ) ;
29212921 await fse . ensureDir ( path . dirname ( outfile ) ) ;
29222922 await fse . outputFile ( outfile , content ) ;
0 commit comments