Skip to content

Commit

Permalink
fix: use compile instead of beforeCompile to prevent duplicate calls
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 4, 2018
1 parent 09459af commit 05cf301
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/plugin.js
Expand Up @@ -129,15 +129,15 @@ export default class WebpackBarPlugin extends ProgressPlugin {
}
}

// Adds a hook right before compiler.run() is executed
hook('beforeCompile', () => {
// Hook into the compiler before a new compilation is created.
hook('compile', () => {
Object.assign(this.state, {
...DEFAULT_STATE,
start: process.hrtime(),
_allDoneCalled: false,
});

this.callReporters('beforeRun');
this.callReporters('start');
});

// Compilation has completed
Expand Down
2 changes: 1 addition & 1 deletion src/reporters/basic.js
@@ -1,7 +1,7 @@
import { consola } from '../utils/cli';

export default class SimpleReporter {
beforeRun(context) {
start(context) {
consola.info(`Compiling ${context.state.name}`);
}

Expand Down
2 changes: 1 addition & 1 deletion src/reporters/fancy.js
Expand Up @@ -12,7 +12,7 @@ const logUpdate = new LogUpdate();
let lastRender = Date.now();

export default class FancyReporter {
beforeRun() {
start() {
consola.pause();
}

Expand Down

0 comments on commit 05cf301

Please sign in to comment.