mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-13 12:40:18 -05:00
fix: use sync fs methods in writeFileTree (#2341)
closes #2275 Iterating over async functions would put too many write calls in I/O queue in the same time, leading to weird bugs.
This commit is contained in:
@@ -19,9 +19,9 @@ module.exports = async function writeFileTree (dir, files, previousFiles) {
|
||||
if (previousFiles) {
|
||||
await deleteRemovedFiles(dir, files, previousFiles)
|
||||
}
|
||||
return Promise.all(Object.keys(files).map(async (name) => {
|
||||
Object.keys(files).forEach((name) => {
|
||||
const filePath = path.join(dir, name)
|
||||
await fs.ensureDir(path.dirname(filePath))
|
||||
await fs.writeFile(filePath, files[name])
|
||||
}))
|
||||
fs.ensureDirSync(path.dirname(filePath))
|
||||
fs.writeFileSync(filePath, files[name])
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user