From e9060a1ab1ace6a7e62e3627391603da90174dfd Mon Sep 17 00:00:00 2001 From: Mark Raymond Date: Mon, 19 Nov 2018 16:17:46 +0000 Subject: [PATCH] Use webpack-4 style hooks. --- src/components/auto-increase-version/auto-increase-version.js | 2 +- src/components/inject-as-comment/inject-as-comment.js | 2 +- src/components/inject-by-tag/inject-by-tag.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/auto-increase-version/auto-increase-version.js b/src/components/auto-increase-version/auto-increase-version.js index 27c9557..180d415 100644 --- a/src/components/auto-increase-version/auto-increase-version.js +++ b/src/components/auto-increase-version/auto-increase-version.js @@ -32,7 +32,7 @@ export default class AutoIncreaseVersion { // we have to register AutoIncreaseVersion instead of firing it straight away if (config.componentsOptions.AutoIncreaseVersion.runInWatchMode) { if (this.context.compiler) { - this.context.compiler.plugin('emit', (compilation, cb) => { + this.context.compiler.hooks.emit.tap((compilation, cb) => { this.start(); cb(); }); diff --git a/src/components/inject-as-comment/inject-as-comment.js b/src/components/inject-as-comment/inject-as-comment.js index aea57af..9056dec 100644 --- a/src/components/inject-as-comment/inject-as-comment.js +++ b/src/components/inject-as-comment/inject-as-comment.js @@ -30,7 +30,7 @@ export default class InjectAsComment { */ apply() { // bind into emit hook - this.context.compiler.plugin('emit', (compilation, cb) => { + this.context.compiler.hooks.emit.tap((compilation, cb) => { // iterate over all assets file in compilation for (const basename in compilation.assets) { // bug fix, extname is not able to handle chunk file params index.js?random123 diff --git a/src/components/inject-by-tag/inject-by-tag.js b/src/components/inject-by-tag/inject-by-tag.js index c22f66b..61276f6 100644 --- a/src/components/inject-by-tag/inject-by-tag.js +++ b/src/components/inject-by-tag/inject-by-tag.js @@ -21,7 +21,7 @@ export default class InjectByTag { * @return {Promise} */ apply() { - this.context.compiler.plugin('emit', (compilation, cb) => { + this.context.compiler.hooks.emit.tap((compilation, cb) => { // for every output file for (const basename in compilation.assets) { // only if match regex