Skip to content

Commit

Permalink
fix: fix hasRunning and and hasErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 2, 2018
1 parent ab32217 commit 2241cd7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,22 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
}
}

get hasRunning() {
return Object.keys(this.states)
.map((e) => this.states[e])
.find((s) => s.isRunning);
hasRunning() {
return this.states.some((state) => state.isRunning);
}

hasErrors() {
return Object.values(context.states).some(
(state) => state.stats && state.stats.hasErrors()
);
}

apply(compiler) {
super.apply(compiler);

const hook = (stats) => {
this.state.stats = stats;
if (!this.hasRunning) {
if (!this.hasRunning()) {
this.callReporters('done');
}
};
Expand Down

0 comments on commit 2241cd7

Please sign in to comment.