@@ -92,7 +92,6 @@ export async function viteBuild(opts: StaticBuildOptions) {
9292 const ssrOutputs = viteBuildReturnToRollupOutputs ( ssrOutput ) ;
9393 const clientOutputs = viteBuildReturnToRollupOutputs ( clientOutput ?? [ ] ) ;
9494 await runPostBuildHooks ( container , ssrOutputs , clientOutputs ) ;
95- let contentFileNames : string [ ] | undefined = undefined ;
9695 settings . timer . end ( 'Client build' ) ;
9796
9897 // Free up memory
@@ -112,20 +111,19 @@ export async function viteBuild(opts: StaticBuildOptions) {
112111 }
113112 }
114113
115- return { internals, ssrOutputChunkNames, contentFileNames } ;
114+ return { internals, ssrOutputChunkNames } ;
116115}
117116
118117export async function staticBuild (
119118 opts : StaticBuildOptions ,
120119 internals : BuildInternals ,
121120 ssrOutputChunkNames : string [ ] ,
122- contentFileNames ?: string [ ] ,
123121) {
124122 const { settings } = opts ;
125123 if ( settings . buildOutput === 'static' ) {
126124 settings . timer . start ( 'Static generate' ) ;
127125 await generatePages ( opts , internals ) ;
128- await cleanServerOutput ( opts , ssrOutputChunkNames , contentFileNames , internals ) ;
126+ await cleanServerOutput ( opts , ssrOutputChunkNames , internals ) ;
129127 settings . timer . end ( 'Static generate' ) ;
130128 } else if ( settings . buildOutput === 'server' ) {
131129 settings . timer . start ( 'Server generate' ) ;
@@ -354,14 +352,12 @@ async function cleanStaticOutput(opts: StaticBuildOptions, internals: BuildInter
354352async function cleanServerOutput (
355353 opts : StaticBuildOptions ,
356354 ssrOutputChunkNames : string [ ] ,
357- contentFileNames : string [ ] | undefined ,
358355 internals : BuildInternals ,
359356) {
360357 const out = getOutDirWithinCwd ( opts . settings . config . outDir ) ;
361358 // The SSR output chunks for Astro are all .mjs files
362359 const files = ssrOutputChunkNames
363- . filter ( ( f ) => f . endsWith ( '.mjs' ) )
364- . concat ( contentFileNames ?? [ ] ) ;
360+ . filter ( ( f ) => f . endsWith ( '.mjs' ) ) ;
365361 if ( internals . manifestFileName ) {
366362 files . push ( internals . manifestFileName ) ;
367363 }
@@ -370,7 +366,11 @@ async function cleanServerOutput(
370366 await Promise . all (
371367 files . map ( async ( filename ) => {
372368 const url = new URL ( filename , out ) ;
373- await fs . promises . rm ( url ) ;
369+ const map = new URL ( url + '.map' ) ;
370+ await Promise . all ( [
371+ fs . promises . rm ( url ) ,
372+ fs . promises . rm ( new URL ( map ) ) . catch ( ( e ) => { } )
373+ ] ) ;
374374 } ) ,
375375 ) ;
376376
@@ -426,6 +426,8 @@ async function ssrMoveAssets(opts: StaticBuildOptions) {
426426 cwd : fileURLToPath ( serverAssets ) ,
427427 } ) ;
428428
429+ console . log ( "FILES2" , files ) ;
430+
429431 if ( files . length > 0 ) {
430432 await Promise . all (
431433 files . map ( async function moveAsset ( filename ) {
0 commit comments