2017-11-07 10:47:55 +00:00
|
|
|
// Taken from https://github.com/egoist/poi/blob/3e93c88c520db2d20c25647415e6ae0d3de61145/packages/poi/lib/webpack/timefix-plugin.js#L1-L16
|
|
|
|
// Thanks to @egoist
|
2017-12-12 09:42:29 +00:00
|
|
|
module.exports = class TimeFixPlugin {
|
2018-02-26 10:44:24 +00:00
|
|
|
constructor(timefix = 5000) {
|
2017-11-07 10:47:55 +00:00
|
|
|
this.timefix = timefix
|
|
|
|
}
|
|
|
|
|
|
|
|
apply(compiler) {
|
2018-02-26 10:44:24 +00:00
|
|
|
compiler.hooks.watchRun.tap('timefix-plugin', (watching, callback) => {
|
2017-11-07 10:47:55 +00:00
|
|
|
watching.startTime += this.timefix
|
|
|
|
callback()
|
|
|
|
})
|
|
|
|
|
2018-02-26 10:44:24 +00:00
|
|
|
compiler.hooks.done.tap('timefix-plugin', stats => {
|
2017-11-07 10:47:55 +00:00
|
|
|
stats.startTime -= this.timefix
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|