diff --git a/.changeset/small-camels-mix.md b/.changeset/small-camels-mix.md new file mode 100644 index 000000000..99aaa8b72 --- /dev/null +++ b/.changeset/small-camels-mix.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix static build regression where chunks would not be generated diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 337730747..c44858f74 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -362,7 +362,9 @@ async function cleanServerOutput(opts: StaticBuildOptions) { await Promise.all( Array.from(directories).map(async (filename) => { 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) { await fs.promises.rm(url, { recursive: true, force: true }); }