Fixing 'DeprecationWarning: Tapable.plugin is deprecated. Use new API on .hooks instead' causing production build fail

This commit is contained in:
Aleksandar Ristevski 2018-12-17 20:39:35 +00:00
parent f754feae72
commit c0c12982de
4 changed files with 254 additions and 254 deletions

View file

@ -3066,7 +3066,7 @@ var AutoIncreaseVersion = function () {
// we have to register AutoIncreaseVersion instead of firing it straight away // we have to register AutoIncreaseVersion instead of firing it straight away
if (_config2.default.componentsOptions.AutoIncreaseVersion.runInWatchMode) { if (_config2.default.componentsOptions.AutoIncreaseVersion.runInWatchMode) {
if (this.context.compiler) { if (this.context.compiler) {
this.context.compiler.plugin('emit', function (compilation, cb) { this.context.compiler.hooks.emit.tapAsync('EmitAutoIncreaseVersion', function (compilation, cb) {
_this.start(); _this.start();
cb(); cb();
}); });
@ -3276,7 +3276,7 @@ var InjectAsComment = function () {
var _this = this; var _this = this;
// bind into emit hook // bind into emit hook
this.context.compiler.plugin('emit', function (compilation, cb) { this.context.compiler.hooks.emit.tapAsync('EmitInjectAsComment', function (compilation, cb) {
// iterate over all assets file in compilation // iterate over all assets file in compilation
for (var basename in compilation.assets) { for (var 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
@ -3508,7 +3508,7 @@ var InjectByTag = function () {
value: function apply() { value: function apply() {
var _this = this; var _this = this;
this.context.compiler.plugin('emit', function (compilation, cb) { this.context.compiler.hooks.emit.tapAsync('EmitInjectByTag', function (compilation, cb) {
// for every output file // for every output file
for (var basename in compilation.assets) { for (var basename in compilation.assets) {
// only if match regex // only if match regex

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.tapAsync('EmitAutoIncreaseVersion', (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.tapAsync('EmitInjectAsComment', (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.tapAsync('EmitInjectByTag', (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