create-react-app: react-scripts 4.0.1 is very slow

Describe the bug

react-scripts 4.0.1 is very slow on start and reload, by and without FAST_RELOAD, yarn start takes more than 2 minute now after update.

Did you try recovering your dependencies?

yes

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Ubuntu v20.10 Node v12.18.2 LTS yarn v1.22.5

Steps to reproduce

  1. update react-scripts to v4.0.1
  2. using typescript
  3. large scale project

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 40
  • Comments: 15 (1 by maintainers)

Commits related to this issue

Most upvoted comments

If you use WSL, you should create a folder in WSL system (e.i. /home/user/folder), because /mnt/... is very slow. If you use remote server check its load with command htop. If it’s ok, your system is slow, upgrade it 😃

You just have to create a blank project using npx create-react-app slow-issues and start it using npm start.

I personally have around 7 seconds of compiling time on a blank project.

Version of CRA

npx create-react-app --version
npx : 67 installed within 7.081s
4.0.1

This is indeed a problem @ianschmitz, and I’ve confirmed what @imsandez reported above.

Also, I’ve opened an issue with the eslint-webpack-plugin since it’s originating from there.

Adding

  "resolutions": {
    "react-scripts/eslint-webpack-plugin": "2.3.0"
  }

At the end of package.json and yarn again will fix the issues. It is currently being discussed here: https://github.com/webpack-contrib/eslint-webpack-plugin/issues/52

@eek Thank you ! As a beginner, I’d specify the package.json file of the react-scripts dependancy in the node modules’ folder (I thought about the package.json file at the root of the project but of course it didn’t work). I followed your instructions:

  1. set “threads: false” in react-scripts’ webpack.config.js
  2. added “resolution” in react-scripts’ package.json file
  3. npm install

Went from more than 2mins to start the project to 6s…thank you so much !

image Hi guys, I don’t see any “threads: false” in my webpack.config.js file. Where can I find this? or where can I manually add it?

I know this has been there for 2 years, but I followed @eek 's answer and added :

webstorm64_QRR2pNj0JL

in webpack.config.js of react-scripts package, I also added react-scripts/eslint-webpack-plugin :

O6OpvdvCGk

And ran Npm install, I don’t know if that changed anything, but I went from 20+ min to run my app with npm start to ~2-3 min to run it.

Not yet optimal, but that’s way better.

I reinstall node js and it’s good

If you use WSL, you should create a folder in WSL system (e.i. /home/user/folder), because /mnt/... is very slow. If you use remote server check its load with command htop. If it’s ok, your system is slow, upgrade it 😃

thank you for the answer, but I noticed that the problem came from my operating system, by the way I was using windows 11, now I am going back to windows 10 and there is no more this problem thank you

If you use WSL, you should create a folder in WSL system (e.i. /home/user/folder), because /mnt/... is very slow. If you use remote server check its load with command htop. If it’s ok, your system is slow, upgrade it 😃

thank you for the answer, but I noticed that the problem came from my operating system, by the way I was using windows 11, now I am going back to windows 10 and there is no more this problem thank you

I think my laptop was slow, I bought it 7 years ago. The new one works perfectly fine and react scripts don’t have this problem anymore.

ok

Yes

If you use WSL, you should create a folder in WSL system (e.i. /home/user/folder), because /mnt/... is very slow. If you use remote server check its load with command htop. If it’s ok, your system is slow, upgrade it 😃

Same for me! Thaks fo the tip! WSL Ubuntu 20.04 on /mnt/...

@eek Thank you ! As a beginner, I’d specify the package.json file of the react-scripts dependancy in the node modules’ folder (I thought about the package.json file at the root of the project but of course it didn’t work). I followed your instructions:

  1. set “threads: false” in react-scripts’ webpack.config.js
  2. added “resolution” in react-scripts’ package.json file
  3. npm install

Went from more than 2mins to start the project to 6s…thank you so much !