Skip to content

Commit 7ae4928

Browse files
authored
fix: remove the manifest file from the dist/ folder (#9475)
1 parent 69e7882 commit 7ae4928

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

.changeset/wise-wasps-sell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'astro': patch
3+
---
4+
5+
Remove the manifest from the generated files in the `dist/` folder.

packages/astro/src/core/build/static-build.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)