Skip to content

Commit

Permalink
Fix the deprecation warning:
Browse files Browse the repository at this point in the history
> DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

Fixes 1337programming#61

Thanks @tlaak
  • Loading branch information
cdeutsch committed Apr 24, 2018
1 parent ac6ae7a commit b3fe764
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ var WebpackShellPlugin = function () {
value: function apply(compiler) {
var _this = this;

compiler.plugin('compilation', function (compilation) {
compiler.hook.compilation.tap('WebpackShellPlugin', function (compilation) {
if (_this.options.verbose) {
console.log('Report compilation: ' + compilation);
console.warn('WebpackShellPlugin [' + new Date() + ']: Verbose is being deprecated, please remove.');
Expand All @@ -136,7 +136,7 @@ var WebpackShellPlugin = function () {
}
});

compiler.plugin('after-emit', function (compilation, callback) {
compiler.hooks.afterEmit.tapAsync('WebpackShellPlugin', function (compilation, callback) {
if (_this.options.onBuildEnd.length) {
console.log('Executing post-build scripts');
for (var i = 0; i < _this.options.onBuildEnd.length; i++) {
Expand All @@ -149,7 +149,7 @@ var WebpackShellPlugin = function () {
callback();
});

compiler.plugin('done', function () {
compiler.hook.done.tap('WebpackShellPlugin', function () {
if (_this.options.onBuildExit.length) {
console.log('Executing additional scripts before exit');
for (var i = 0; i < _this.options.onBuildExit.length; i++) {
Expand Down
6 changes: 3 additions & 3 deletions src/webpack-shell-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class WebpackShellPlugin {

apply(compiler) {

compiler.plugin('compilation', (compilation) => {
compiler.hook.compilation.tap('WebpackShellPlugin', (compilation) => {
if (this.options.verbose) {
console.log(`Report compilation: ${compilation}`);
console.warn(`WebpackShellPlugin [${new Date()}]: Verbose is being deprecated, please remove.`);
Expand All @@ -86,7 +86,7 @@ export default class WebpackShellPlugin {
}
});

compiler.plugin('after-emit', (compilation, callback) => {
compiler.hooks.afterEmit.tapAsync('WebpackShellPlugin', (compilation, callback) => {
if (this.options.onBuildEnd.length) {
console.log('Executing post-build scripts');
for (let i = 0; i < this.options.onBuildEnd.length; i++) {
Expand All @@ -99,7 +99,7 @@ export default class WebpackShellPlugin {
callback();
});

compiler.plugin('done', () => {
compiler.hook.done.tap('WebpackShellPlugin', () => {
if (this.options.onBuildExit.length) {
console.log('Executing additional scripts before exit');
for (let i = 0; i < this.options.onBuildExit.length; i++) {
Expand Down

0 comments on commit b3fe764

Please sign in to comment.