diff --git a/.changeset/forty-dodos-dress.md b/.changeset/forty-dodos-dress.md new file mode 100644 index 000000000000..8876c3460b91 --- /dev/null +++ b/.changeset/forty-dodos-dress.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +don't finish the action of the copy before removing all files. diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index dae67b439898..e65d1bea5bb0 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -343,7 +343,7 @@ async function cleanServerOutput(opts: StaticBuildOptions) { // Clean out directly if the outDir is outside of root if (out.toString() !== opts.settings.config.outDir.toString()) { // Copy assets before cleaning directory if outside root - copyFiles(out, opts.settings.config.outDir); + await copyFiles(out, opts.settings.config.outDir); await fs.promises.rm(out, { recursive: true }); return; }