0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: remove the manifest file from the dist/ folder (#9475)

This commit is contained in:
Emanuele Stoppa 2023-12-19 21:56:46 +00:00 committed by GitHub
parent 69e78822e5
commit 7ae4928f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Remove the manifest from the generated files in the `dist/` folder.

View file

@ -115,7 +115,7 @@ export async function viteBuild(opts: StaticBuildOptions) {
teardown(); teardown();
} }
// For static builds, the SSR output output won't be needed anymore after page generation. // For static builds, the SSR output won't be needed anymore after page generation.
// We keep track of the names here so we only remove these specific files when finished. // We keep track of the names here so we only remove these specific files when finished.
const ssrOutputChunkNames: string[] = []; const ssrOutputChunkNames: string[] = [];
for (const output of ssrOutputs) { for (const output of ssrOutputs) {
@ -139,7 +139,7 @@ export async function staticBuild(
case settings.config.output === 'static': { case settings.config.output === 'static': {
settings.timer.start('Static generate'); settings.timer.start('Static generate');
await generatePages(opts, internals); await generatePages(opts, internals);
await cleanServerOutput(opts, ssrOutputChunkNames); await cleanServerOutput(opts, ssrOutputChunkNames, internals);
settings.timer.end('Static generate'); settings.timer.end('Static generate');
return; return;
} }
@ -413,10 +413,17 @@ async function cleanStaticOutput(
} }
} }
async function cleanServerOutput(opts: StaticBuildOptions, ssrOutputChunkNames: string[]) { async function cleanServerOutput(
opts: StaticBuildOptions,
ssrOutputChunkNames: string[],
internals: BuildInternals
) {
const out = getOutDirWithinCwd(opts.settings.config.outDir); const out = getOutDirWithinCwd(opts.settings.config.outDir);
// The SSR output chunks for Astro are all .mjs files // The SSR output chunks for Astro are all .mjs files
const files = ssrOutputChunkNames.filter((f) => f.endsWith('.mjs')); const files = ssrOutputChunkNames.filter((f) => f.endsWith('.mjs'));
if (internals.manifestFileName) {
files.push(internals.manifestFileName);
}
if (files.length) { if (files.length) {
// Remove all the SSR generated .mjs files // Remove all the SSR generated .mjs files
await Promise.all( await Promise.all(