@@ -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