"TypeError: MiniCssExtractPlugin is not a constructor" in fresh CRA installation
See original GitHub issueDescribe the bug
CRA build fails with
TypeError: MiniCssExtractPlugin is not a constructor
at module.exports (/home/john/Projects/test/node_modules/react-scripts/config/webpack.config.js:664:9)
at Object.<anonymous> (/home/john/Projects/test/node_modules/react-scripts/scripts/build.js:58:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
Did you try recovering your dependencies?
Clearing package-lock.json
and node_modules
did not help at all.
└─▪ npm --version
8.3.0
Which terms did you search for in User Guide?
I have been searching for this error for a few hours but I can’t find it anywhere. It shouldn’t be happening on a fresh installation.
Environment
Environment Info:
current version of create-react-app: 5.0.0
running from /home/john/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app
System:
OS: Linux 5.15 Arch Linux
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 14.18.2 - /usr/bin/node
Yarn: 1.22.17 - /usr/bin/yarn
npm: 8.3.0 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: 96.0
npmPackages:
react: ^17.0.2 => 17.0.2
react-dom: ^17.0.2 => 17.0.2
react-scripts: 5.0.0 => 5.0.0
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
Issue can be replicated easily via
npx create-react-app test
cd test
npm run build
Expected behavior
I expected npm run build
to work without errors.
Actual behavior
It produced the error TypeError: MiniCssExtractPlugin is not a constructor
instead.
Reproducible demo
git clone https://github.com/jathanasiou/react-mincss-crash.git
cd react-mincss-crash
npm i && npm run build
Issue Analytics
- State:
- Created 2 years ago
- Reactions:104
- Comments:66
Top Results From Across the Web
TypeError: MiniCssExtractPlugin is not a constructor
I have got this error and don't understand why it happens. I didn't change any package version and have just done npm install...
Read more >`npm run build`, error `TypeError: MiniCssExtractPlugin is not ...
There is an update to mini-css-extract-plugin in version 2.5.0. I temporarily fixed it by adding in ... TypeError: MiniCssExtractPlugin is not a constructor...
Read more >React の build で MiniCssExtractPlugin is not a constructor と ...
"TypeError: MiniCssExtractPlugin is not a constructor" in fresh CRA installation #11930. 原因は、ここに書いてある通り、 ...
Read more >TypeError: MiniCssExtractPlugin is not a constructor - Drupal
TypeError : MiniCssExtractPlugin is not a constructor. Closed (fixed). Project: Bootstrap Italia. Version: 8.x-0.20. Component:.
Read more >Clone of playsnake.org using React and TypeScript
React swipe event handler hook · Swipe effect in react js · “TypeError: MiniCssExtractPlugin is not a constructor” in fresh CRA installation ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
resolutions
isyarn
feature. If you’re not usingyarn
, you can either runor if you’re using
npm@>=8.3.0
, addoverrides
to your
package.json
, and runnpm i
I think it’s because of an update to
mini-css-extract-plugin
which was bumped 4 hours ago to version2.5.0
. I temporarily fixed it by adding:in
package.json
.