@@ -115,7 +115,7 @@ export async function viteBuild(opts: StaticBuildOptions) {
115115 teardown ( ) ;
116116 }
117117
118- // For static builds, the SSR output output won't be needed anymore after page generation.
118+ // For static builds, the SSR output won't be needed anymore after page generation.
119119 // We keep track of the names here so we only remove these specific files when finished.
120120 const ssrOutputChunkNames : string [ ] = [ ] ;
121121 for ( const output of ssrOutputs ) {
@@ -139,7 +139,7 @@ export async function staticBuild(
139139 case settings . config . output === 'static' : {
140140 settings . timer . start ( 'Static generate' ) ;
141141 await generatePages ( opts , internals ) ;
142- await cleanServerOutput ( opts , ssrOutputChunkNames ) ;
142+ await cleanServerOutput ( opts , ssrOutputChunkNames , internals ) ;
143143 settings . timer . end ( 'Static generate' ) ;
144144 return ;
145145 }
@@ -413,10 +413,17 @@ async function cleanStaticOutput(
413413 }
414414}
415415
416- async function cleanServerOutput ( opts : StaticBuildOptions , ssrOutputChunkNames : string [ ] ) {
416+ async function cleanServerOutput (
417+ opts : StaticBuildOptions ,
418+ ssrOutputChunkNames : string [ ] ,
419+ internals : BuildInternals
420+ ) {
417421 const out = getOutDirWithinCwd ( opts . settings . config . outDir ) ;
418422 // The SSR output chunks for Astro are all .mjs files
419423 const files = ssrOutputChunkNames . filter ( ( f ) => f . endsWith ( '.mjs' ) ) ;
424+ if ( internals . manifestFileName ) {
425+ files . push ( internals . manifestFileName ) ;
426+ }
420427 if ( files . length ) {
421428 // Remove all the SSR generated .mjs files
422429 await Promise . all (
0 commit comments