mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +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
|
// Taken from https://github.com/egoist/poi/blob/3e93c88c520db2d20c25647415e6ae0d3de61145/packages/poi/lib/webpack/timefix-plugin.js#L1-L16
|
||||||
// Thanks to @egoist
|
// Thanks to @egoist
|
||||||
module.exports = class TimeFixPlugin {
|
module.exports = class TimeFixPlugin {
|
||||||
constructor(timefix = 11000) {
|
constructor(timefix = 5000) {
|
||||||
this.timefix = timefix
|
this.timefix = timefix
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.plugin('watch-run', (watching, callback) => {
|
compiler.hooks.watchRun.tap('timefix-plugin', (watching, callback) => {
|
||||||
watching.startTime += this.timefix
|
watching.startTime += this.timefix
|
||||||
callback()
|
callback()
|
||||||
})
|
})
|
||||||
|
|
||||||
compiler.plugin('done', stats => {
|
compiler.hooks.done.tap('timefix-plugin', stats => {
|
||||||
stats.startTime -= this.timefix
|
stats.startTime -= this.timefix
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = class WarnFixPlugin {
|
module.exports = class WarnFixPlugin {
|
||||||
apply(compiler) /* istanbul ignore next */ {
|
apply(compiler) /* istanbul ignore next */ {
|
||||||
compiler.plugin('done', stats => {
|
compiler.hooks.done.tap('warnfix-plugin', stats => {
|
||||||
stats.compilation.warnings = stats.compilation.warnings.filter(warn => {
|
stats.compilation.warnings = stats.compilation.warnings.filter(warn => {
|
||||||
if (
|
if (
|
||||||
warn.name === 'ModuleDependencyWarning' &&
|
warn.name === 'ModuleDependencyWarning' &&
|
||||||
|
Loading…
Reference in New Issue
Block a user