From 02c37c7b8cefcbf1e644c43c237c72ce27b17389 Mon Sep 17 00:00:00 2001 From: Simon He <57086651+Simon-He95@users.noreply.github.com> Date: Tue, 25 Jun 2024 21:32:31 +0800 Subject: [PATCH] refactor(plugin-content): code refactor (#11312) --- packages/astro/src/core/build/plugins/plugin-content.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/astro/src/core/build/plugins/plugin-content.ts b/packages/astro/src/core/build/plugins/plugin-content.ts index 3f0da0d5f7ae..28000e73392d 100644 --- a/packages/astro/src/core/build/plugins/plugin-content.ts +++ b/packages/astro/src/core/build/plugins/plugin-content.ts @@ -508,11 +508,15 @@ export function pluginContent( return; } // Cache build output of chunks and assets + const promises: Promise[] = [] for (const { cached, dist } of cachedBuildOutput) { if (fsMod.existsSync(dist)) { - await copyFiles(dist, cached, true); + promises.push(copyFiles(dist, cached, true)); } } + + if (promises.length) + await Promise.all(promises) }, }, };