mini-css-extract-plugin: TypeError: Invalid value used in weak set
- Operating System: MacOS Big Sur 11.1
- Node Version: v10.16.3
- NPM Version: 6.9.0
- webpack Version: 4.44.2
- mini-css-extract-plugin Version: 2.0.0
Expected Behavior
Npm run build
succeed
Actual Behavior
TypeError: Invalid value used in weak set at WeakSet.add (<anonymous>) at MiniCssExtractPlugin.apply (/Users/grzegorztarnowski/***/***/web/node_modules/mini-css-extract-plugin/dist/index.js:362:18)
Code
webpack.common.js
https://gist.github.com/gtarnowski/8c3bd7ca346bb15af5913d586efb3fd4
package.json
https://gist.github.com/gtarnowski/828fe24c13304376677e93c0e72bdc75
How Do We Reproduce?
Error shows on npm run build
process.
After downgrading mini-css-extract-plugin
to version 1.6.2
- error disappear. The error appears in the new version, so I report it.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15 (6 by maintainers)
Some less experienced developers (like me) can didn’t know that changelog can include such information. But im glad that you give me a lesson in such kind way.
You need webpack v5 to use the 2.0.0 version, please read the changelog before update, I really don’t understand why the developers don’t do it, it is major release so breaking changes expected
Another way this error can manifest if you accidentally put
new MiniCssExtractPlugin()
underresolve.plugins
rather thanplugins
. Hope that helps someoneLooks like you have multiple webpack versions for the one project, it can be problem when you mix it for webpack v4, we fixed it in webpack v5, so for webpack v6 you will not have this problem, unfortunately we can’t fix it in webpack v4…
Same issue here using webpack 5.65.0 and mini-css-extract-plugin 2.4.5
My dev dependencies
good catch, let’s remove it, only webpack v5 supported right now