Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(util): copyDir may cause an infinite loop (#4310)
  • Loading branch information
ygj6 committed Jul 19, 2021
1 parent e47a6f2 commit da64197
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/vite/src/node/utils.ts
Expand Up @@ -351,6 +351,9 @@ export function copyDir(srcDir: string, destDir: string): void {
fs.mkdirSync(destDir, { recursive: true })
for (const file of fs.readdirSync(srcDir)) {
const srcFile = path.resolve(srcDir, file)
if (srcFile === destDir) {
continue
}
const destFile = path.resolve(destDir, file)
const stat = fs.statSync(srcFile)
if (stat.isDirectory()) {
Expand Down

0 comments on commit da64197

Please sign in to comment.