Use webpack-4 style hooks.

This commit is contained in:
Mark Raymond 2018-11-19 16:17:46 +00:00
parent f754feae72
commit e9060a1ab1
3 changed files with 3 additions and 3 deletions

View file

@ -32,7 +32,7 @@ export default class AutoIncreaseVersion {
// we have to register AutoIncreaseVersion instead of firing it straight away // we have to register AutoIncreaseVersion instead of firing it straight away
if (config.componentsOptions.AutoIncreaseVersion.runInWatchMode) { if (config.componentsOptions.AutoIncreaseVersion.runInWatchMode) {
if (this.context.compiler) { if (this.context.compiler) {
this.context.compiler.plugin('emit', (compilation, cb) => { this.context.compiler.hooks.emit.tap((compilation, cb) => {
this.start(); this.start();
cb(); cb();
}); });

View file

@ -30,7 +30,7 @@ export default class InjectAsComment {
*/ */
apply() { apply() {
// bind into emit hook // 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 // iterate over all assets file in compilation
for (const basename in compilation.assets) { for (const basename in compilation.assets) {
// bug fix, extname is not able to handle chunk file params index.js?random123 // bug fix, extname is not able to handle chunk file params index.js?random123

View file

@ -21,7 +21,7 @@ export default class InjectByTag {
* @return {Promise} * @return {Promise}
*/ */
apply() { apply() {
this.context.compiler.plugin('emit', (compilation, cb) => { this.context.compiler.hooks.emit.tap((compilation, cb) => {
// for every output file // for every output file
for (const basename in compilation.assets) { for (const basename in compilation.assets) {
// only if match regex // only if match regex