The TypeError: minicssextractplugin is not a constructor error occurs in JavaScript when there is a reference to an object named “minicssextractplugin” being used as a constructor, but that object is not a constructor. It is possible that this object is undefined or not a function that can be used as a constructor.
To fix the TypeError: minicssextractplugin is not a constructor error, install the latest version of the “mini-css-extract-plugin” module because the developer team has fixed this issue.
You can install the latest version of “mini-css-extract-plugin” using the below command.
npm i mini-css-extract-plugin
At the time of this article, the latest version is 2.7.2.
Using Yarn
If you use the Yarn package manager to manage the node_modules, add the code below inside the package.json file.
"resolutions": {
"mini-css-extract-plugin": "2.7.2"
},
Using NPM
If you use the npm to manage the node_modules, use the below command.
npm i -D --save-exact mini-css-extract-plugin@2.7.2
And that’s it.
Conclusion
Install the latest version of “mini-css-extract-plugin” using the npm i mini-css-extract-plugin command to fix the TypeError: minicssextractplugin is not a constructor error in JavaScript.