fix: patch static build regression (#5644)

Co-authored-by: Nate Moore <nate@astro.build>
This commit is contained in:
Nate Moore 2022-12-19 10:23:57 -05:00 committed by GitHub
parent 62580ed078
commit d5aff85db4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix static build regression where chunks would not be generated

View file

@ -362,7 +362,9 @@ async function cleanServerOutput(opts: StaticBuildOptions) {
await Promise.all( await Promise.all(
Array.from(directories).map(async (filename) => { Array.from(directories).map(async (filename) => {
const url = new URL(filename, out); const url = new URL(filename, out);
const dir = await glob(fileURLToPath(url), { absolute: true }); const dir = await glob(fileURLToPath(url));
// Do not delete chunks/ directory!
if (filename === 'chunks') return;
if (!dir.length) { if (!dir.length) {
await fs.promises.rm(url, { recursive: true, force: true }); await fs.promises.rm(url, { recursive: true, force: true });
} }