react-scripts build giving error - "MiniCssExtractPlugin is not a constructor"

Viewed 18

First I created a basic react app with:

npx create-react-app docker-react

Then I ran the build command and got the following error:

$ npm run build

> docker-react@0.1.0 build
> react-scripts build

C:\Users\charl\Desktop\docker-react\node_modules\react-scripts\config\webpack.config.js:664
        new MiniCssExtractPlugin({
        ^

TypeError: MiniCssExtractPlugin is not a constructor
    at module.exports (C:\Users\charl\Desktop\docker-react\node_modules\react-scripts\config\webpack.config.js:664:9)
    at Object.<anonymous> (C:\Users\charl\Desktop\docker-react\node_modules\react-scripts\scripts\build.js:58:16)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47

I'm running across this error when running react-scripts build, but I'm not sure how to solve the issue. I get the same error when trying to run build on both my Windows 10 PC and my Macbook.

0 Answers
Related