Skip to content

Commit

Permalink
fix(cli): 编译 RN 未等待编译完成就执行之后的操作 (#4060)
Browse files Browse the repository at this point in the history
  • Loading branch information
taixw2 authored and luckyadam committed Aug 3, 2019
1 parent 2ef7947 commit c106408
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/taro-cli/src/rn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,27 @@ class Compiler {
*/
buildTemp () {
return new Promise((resolve, reject) => {
const filePaths: string[] = [];
klaw(this.sourceDir)
.on('data', file => {
if (!file.stats.isDirectory()) {
this.processFile(file.path)
filePaths.push(file.path);
}
})
.on('error', (err, item) => {
console.log(err.message)
console.log(item.path)
})
.on('end', () => {
if (!this.hasJDReactOutput) {
this.initProjectFile()
resolve()
} else {
resolve()
}
Promise.all(filePaths.map(filePath => this.processFile(filePath)))
.then(() => {
if (!this.hasJDReactOutput) {
this.initProjectFile()
resolve()
} else {
resolve()
}
})
})
})
}
Expand Down

0 comments on commit c106408

Please sign in to comment.