mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
webpack: upgrade timefix and warnfix plugins to use hooks
This commit is contained in:
parent
f987d16adb
commit
08d02ddb10
@ -1,17 +1,17 @@
|
||||
// Taken from https://github.com/egoist/poi/blob/3e93c88c520db2d20c25647415e6ae0d3de61145/packages/poi/lib/webpack/timefix-plugin.js#L1-L16
|
||||
// Thanks to @egoist
|
||||
module.exports = class TimeFixPlugin {
|
||||
constructor(timefix = 11000) {
|
||||
constructor(timefix = 5000) {
|
||||
this.timefix = timefix
|
||||
}
|
||||
|
||||
apply(compiler) {
|
||||
compiler.plugin('watch-run', (watching, callback) => {
|
||||
compiler.hooks.watchRun.tap('timefix-plugin', (watching, callback) => {
|
||||
watching.startTime += this.timefix
|
||||
callback()
|
||||
})
|
||||
|
||||
compiler.plugin('done', stats => {
|
||||
compiler.hooks.done.tap('timefix-plugin', stats => {
|
||||
stats.startTime -= this.timefix
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
module.exports = class WarnFixPlugin {
|
||||
apply(compiler) /* istanbul ignore next */ {
|
||||
compiler.plugin('done', stats => {
|
||||
compiler.hooks.done.tap('warnfix-plugin', stats => {
|
||||
stats.compilation.warnings = stats.compilation.warnings.filter(warn => {
|
||||
if (
|
||||
warn.name === 'ModuleDependencyWarning' &&
|
||||
|
Loading…
Reference in New Issue
Block a user