Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wise-wasps-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Remove the manifest from the generated files in the `dist/` folder.
13 changes: 10 additions & 3 deletions packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function viteBuild(opts: StaticBuildOptions) {
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.
const ssrOutputChunkNames: string[] = [];
for (const output of ssrOutputs) {
Expand All @@ -139,7 +139,7 @@ export async function staticBuild(
case settings.config.output === 'static': {
settings.timer.start('Static generate');
await generatePages(opts, internals);
await cleanServerOutput(opts, ssrOutputChunkNames);
await cleanServerOutput(opts, ssrOutputChunkNames, internals);
settings.timer.end('Static generate');
return;
}
Expand Down Expand Up @@ -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);
// The SSR output chunks for Astro are all .mjs files
const files = ssrOutputChunkNames.filter((f) => f.endsWith('.mjs'));
if (internals.manifestFileName) {
files.push(internals.manifestFileName);
}
if (files.length) {
// Remove all the SSR generated .mjs files
await Promise.all(
Expand Down
Loading