diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index 1142df590..f4319b7cf 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -101,7 +101,7 @@ export function viteID(filePath: URL): string { /** An fs utility, similar to `rimraf` or `rm -rf` */ export function removeDir(_dir: URL): void { const dir = fileURLToPath(_dir); - fs.rmSync(dir, { recursive: true, force: true }); + fs.rmSync(dir, { recursive: true, force: true, maxRetries: 3 }); } export function emptyDir(_dir: URL, skip?: Set): void { @@ -111,7 +111,7 @@ export function emptyDir(_dir: URL, skip?: Set): void { if (skip?.has(file)) { continue; } - fs.rmSync(path.resolve(dir, file), { recursive: true, force: true }); + fs.rmSync(path.resolve(dir, file), { recursive: true, force: true, maxRetries: 3 }); } }