-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tapable.plugin is deprecated #61
Comments
Yes, it happens coz of changes in Webpack 4 plugin API. |
How to fix? |
Thanks! |
@iSynth you can also try patching it with https://github.com/ds300/patch-package/ while waiting for a proper fix |
did anyone fix this? |
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);
});
});
}
}
]
}; |
@tlaak if you fixed it, why not submit a PR? :-) |
I was planning to do it, but when I forked the repo, I noticed that it doesn't build without errors etc. If this repo hasn't had any activity during the last year, I'd say the chances of it getting approved are quite slim. |
> DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead Fixes 1337programming#61 Thanks @tlaak
> DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead Fixes 1337programming#61 Thanks @tlaak
> DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead Fixes 1337programming#61 Thanks @tlaak
|
FYI Should be compiler.hooks.[hookName] for anyone copy & pasting |
instred of using WebpackShellPlugin you can use compiler hooks const exec = require('child_process').exec; module.exports = { // ... other config here ... plugins: [
] |
I've tried the above solution anyone had any difficulty calling nodemon even on a simple script that just calls console. When I do this it just hangs, I try running all the I've tried this from within:
I even created a bash script to launch it:
If I use just
It will work until I remove the comments to start the actual server then it just hangs again. Tried this on multiple node versions, same issue, any ideas? |
@thearegee you should not call long-running processes like
Quoting the bash manual:
You may prefer to use package.json |
@jchook but is that not the point of Giving an example, you want to run webpack on your dev server, then when you make a code change to a file, you want to not only be able to trigger webpack transpiling of your files but also a restart of the server so you can see the changes. However I can understand what you are saying, but the other issue was, if we ignore this part about
It just hangs and never starts |
@thearegee no. For that case, use webpack-dev-server, which supports hotloading changes, etc. Usually I think folks run this on their local dev machine or VM.
If you want to automatically update servers in a remote environment such as staging or production, look into CI/CD (continuous integration / continuous delivery) tools or platforms. You have a lot of options there. Personally I enjoyed using Semaphore CI and GitLab (both have a free tier). You can also roll you own CI with tools like
I would bet you $10 that it did start. Have you checked to see whether it listened on |
@jchook it would be hard for me to cash that in but yeah, I would look to see what process would be listening to that port and not see anything ¯_(ツ)_/¯ CI/CD pipelines are not a concern for this project at the moment but thanks for the suggestion. I will have a play with When I come up with a solution I will post it here and might help people who have had same issue. Thank you |
Will there be a release that would fix this soon? |
Seeing as it is stop not fixed and last response almost a year ago, I wouldn’t think a fix is imminent. I did have the same issue with one of my webpack plugins which I fixed over two years ago. In fact, I recall that I also fixed it in this plugin but only locally? I could fork and fix this one as I am not sure the maintainer of this plugin is fixing issues |
Last commits were over 3 years ago so I'd consider this repo very much abandoned. |
I found this that seems to be recently updated. https://github.com/s00d/webpack-shell-plugin-next |
Looks viable to me. I would just go with that version and call it a day. I have looked back on my edits and I did in fact just edit the source locally for the projects I am using. |
WebpackShellPlugin is causing a warning with Webpack 4. When I run
node --trace-deprecation ./node_modules/.bin/webpack
I get this: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 withcompiler.hook.[hookName].tap
orcompiler.hook.[hookName].tapAsync
if it's asynchronous and gets a callback as an argument.The text was updated successfully, but these errors were encountered: