Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-scripts 4.0.1 is very slow #10145

Closed
amaleky opened this issue Nov 25, 2020 · 15 comments
Closed

react-scripts 4.0.1 is very slow #10145

amaleky opened this issue Nov 25, 2020 · 15 comments

Comments

@amaleky
Copy link

amaleky commented Nov 25, 2020

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
@ianschmitz
Copy link
Contributor

Unfortunately without any sort of reproduction steps we can't help diagnose the slow compilation you're experiencing. You may want to take a look at #9886 to see if you're experiencing the same issues, and post your findings in there.

@imsamdez
Copy link

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

@eek
Copy link

eek commented Nov 30, 2020

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: webpack-contrib/eslint-webpack-plugin#52

@dkm94
Copy link

dkm94 commented Mar 8, 2021

@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 !

manix84 added a commit to manix84/lite_event_checkin that referenced this issue May 18, 2021
@zhyrzh
Copy link

zhyrzh commented Jun 30, 2021

@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?

@toutpuissantged
Copy link

my react-script is too slow help me

@FrameMuse
Copy link

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 :)

@toutpuissantged
Copy link

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

@MatrixFrog
Copy link

I've already changed my start script to

  ...
  "scripts": {
    "start": "DISABLE_ESLINT_PLUGIN=true react-scripts start",
  },

to skip linting entirely, so then I assume the

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

change wouldn't affect startup time in my case?

@dkm94
Copy link

dkm94 commented Oct 9, 2021

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.

@toutpuissantged
Copy link

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

@FrameMuse
Copy link

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

@toutpuissantged
Copy link

I reinstall node js and it's good

@packetspy
Copy link

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/...

@Toorain
Copy link

Toorain commented Mar 3, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests