Skip to content

Commit 4e0dc73

Browse files
committed
fix(plugin): handle conditions that start is not available
1 parent 823c7d7 commit 4e0dc73

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/plugin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,17 @@ export default class WebpackBarPlugin extends ProgressPlugin {
169169
hook(compiler, 'done', (stats) => {
170170
this._ensureState();
171171

172-
const time = prettyTime(process.hrtime(this.state.start), 2);
173172
const hasErrors = stats.hasErrors();
174173
const status = hasErrors ? 'with some errors' : 'succesfuly';
175174

175+
const time = this.state.start
176+
? ' in ' + prettyTime(process.hrtime(this.state.start), 2)
177+
: '';
178+
176179
Object.assign(this.state, {
177180
...DEFAULT_STATE,
178181
progress: 100,
179-
message: `Compiled ${status} in ${time}`,
182+
message: `Compiled ${status}${time}`,
180183
hasErrors,
181184
});
182185

0 commit comments

Comments
 (0)