question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tapable.plugin is deprecated

See original GitHub issue

WebpackShellPlugin is causing a warning with Webpack 4. When I run node --trace-deprecation ./node_modules/.bin/webpackI get this:

(node:83992) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
    at WebpackShellPlugin.apply (/projectDir/node_modules/webpack-shell-plugin/lib/index.js:236:16)

I would have submitted a PR, but looks like I can’t build the project without errors and it doesn’t pass linting. In addition, there hasn’t been much activity in a year so in case someone else is encountering the same issue, you can fix it locally.

Just replace all compiler.plugin('hookName', ...) calls with compiler.hook.[hookName].tap or compiler.hook.[hookName].tapAsync if it’s asynchronous and gets a callback as an argument.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:23

github_iconTop GitHub Comments

15reactions
jchookcommented, Apr 12, 2018

I fixed this by ditching the plugin and using the new Webpack Plugin API directly from my webpack config:

const exec = require('child_process').exec;
module.exports = {
  
  // ... other config here ...
  
  plugins: [
  
    // ... other plugins here ...
  
    {
      apply: (compiler) => {
        compiler.hooks.afterEmit.tap('AfterEmitPlugin', (compilation) => {
          exec('<path to your post-build script here>', (err, stdout, stderr) => {
            if (stdout) process.stdout.write(stdout);
            if (stderr) process.stderr.write(stderr);
          });
        });
      }
    }
  ]
};
3reactions
mindplay-dkcommented, Apr 17, 2018

@tlaak alright, thanks for the reply - went with the solution by @jchook which worked 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tapable.plugin is deprecated. Use new API on `.hooks` instead
What is the expected behavior? It shouldn't fail or provide a meaningful message that helps resolving the issue. The current message looks like ......
Read more >
DeprecationWarning: Tapable.plugin is deprecated. Use new ...
There are several plugins that could be causing this warning on Webpack 4 or newer, because they are still using the old plugin...
Read more >
deprecationwarning: maintemplate.hooks.rendermanifest is ...
DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead DeprecationWarning: Tapable.plugin is deprecated. Use new API on .
Read more >
Tapable.plugin is deprecated. Use new API on `.hooks` instead
I am trying to upgrade my Webpack 4 to Webpack5. (Earlier it was Webpack2). On running node --trace-deprecation ...
Read more >
Fixed: Error on yarn start: Tapable.plugin is deprecated - sage
Hi all,. After I have tried to install sage on a lot of different node versions I keep on ending up getting an...
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found