From 5bd68194fedb5d5d5a6f091f66a9542410e6a5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=B1=AA?= <504595380@qq.com> Date: Thu, 24 Feb 2022 01:17:15 +0800 Subject: [PATCH] fix: unlink the outDir twice will report an error (#569) --- src/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index d888abcd..2fcc94a0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -64,7 +64,7 @@ export async function removeFiles(patterns: string[], dir: string) { cwd: dir, absolute: true, }) - await Promise.all(files.map((file) => fs.promises.unlink(file))) + files.forEach((file) => fs.existsSync(file) && fs.unlinkSync(file)) } export function debouncePromise(