Skip to content
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

Error with webpack v5 #42

Open
imathews opened this issue Dec 3, 2020 · 2 comments
Open

Error with webpack v5 #42

imathews opened this issue Dec 3, 2020 · 2 comments

Comments

@imathews
Copy link

imathews commented Dec 3, 2020

We just updated to webpack v5, and unfortunately had to pull unused-webpack-plugin out of our plugins because it seems to be incompatible with the changes in v5. We're seeing the following error when including this plugin in our webpack configuration:

assets/node_modules/unused-files-webpack-plugin/lib/index__8.0.0__.js:105
    compiler.plugin(`after-emit`, (compilation, done) =>
             ^

TypeError: compiler.plugin is not a function
    at UnusedFilesWebpackPlugin.apply (assets/node_modules/unused-files-webpack-plugin/lib/index__8.0.0__.js:105:14)
    at createCompiler (assets/node_modules/webpack/lib/webpack.js:69:12)
    at create (assets/node_modules/webpack/lib/webpack.js:113:15)
    at webpack (assets/node_modules/webpack/lib/webpack.js:137:31)
    at f (assets/node_modules/webpack/lib/index.js:35:15)
@paradite
Copy link

paradite commented May 30, 2021

You might want to checkout https://github.com/MQuy/webpack-deadcode-plugin
It's quite similar to this but has more features. I recently helped to add webpack 5 support to that project.

With that being said, I was able to use this project with webpack 5 as well. It should have handled the new webpack 4/5 syntax:

if (compiler.hooks && compiler.hooks.emit) {
compiler.hooks.emit.tapAsync('UnusedPlugin', checkUnused);

@balovbohdan
Copy link

Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants