Skip to content

Commit

Permalink
fix: fsp.rm removing files does not take effect (#16032)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Apr 5, 2024
1 parent e2658ad commit b05c405
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -504,9 +504,12 @@ export function runOptimizeDeps(
// No need to wait, we can clean up in the background because temp folders
// are unique per run
debug?.(colors.green(`removing cache dir ${processingCacheDir}`))
fsp.rm(processingCacheDir, { recursive: true, force: true }).catch(() => {
try {
// When exiting the process, `fsp.rm` may not take effect, so we use `fs.rmSync`
fs.rmSync(processingCacheDir, { recursive: true, force: true })
} catch (error) {
// Ignore errors
})
}
}
}

Expand Down

0 comments on commit b05c405

Please sign in to comment.