Skip to content

Commit b05c405

Browse files
authored
fix: fsp.rm removing files does not take effect (#16032)
1 parent e2658ad commit b05c405

File tree

1 file changed

+5
-2
lines changed
  • packages/vite/src/node/optimizer

1 file changed

+5
-2
lines changed

packages/vite/src/node/optimizer/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,12 @@ export function runOptimizeDeps(
504504
// No need to wait, we can clean up in the background because temp folders
505505
// are unique per run
506506
debug?.(colors.green(`removing cache dir ${processingCacheDir}`))
507-
fsp.rm(processingCacheDir, { recursive: true, force: true }).catch(() => {
507+
try {
508+
// When exiting the process, `fsp.rm` may not take effect, so we use `fs.rmSync`
509+
fs.rmSync(processingCacheDir, { recursive: true, force: true })
510+
} catch (error) {
508511
// Ignore errors
509-
})
512+
}
510513
}
511514
}
512515

0 commit comments

Comments
 (0)