You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to upgrade from 3.4.1 to 4.0.0 but I noticed that when I make a change it takes approx 20 seconds to recompile. With 3.4.1 it's just a couple of seconds.
Did you try recovering your dependencies?
I deleted node_modules, yarn.lock, and installed the deps.
The recompile time should be almost instantaneous. It also takes a lot of time to start the first time (after yarn start)
Actual behavior
(Write what happened. Please add screenshots!)
The app takes 20 seconds to recompile.
Reproducible demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
Not available, I think it's related to the size of my app (It's 1012 files)
I have exactly the same problem. In a big TypeScript project (~1000 files) before upgrading to react-scripts@4 any code changes were applied immediately.
Any combination of TSC_COMPILE_ON_ERROR and FAST_REFRESH env variables doesn't affect the compilation time.
Same here, I can't viably use 4.0.0 as it stands. Previously I'd get a reload of page in ~2 seconds after changing some code. Now takes ~45 seconds. Initial start time is also about 3-4x slower.
Reacted by Federico Zivolo, Ramin Firooz, Vaibhav Dwivedi, 流浪大法师, gratien, Bambang Mohammad Azhari, KIM, WOOJUNG, Seyyed Mahdi, Malte Bantchev, Asad Dhorajiwala and 22 more
Is anyone aware of a flag that can be set to make the yarn start command log verbose output? I'd like to understand what's the underlying issue but with the existing log there isn't any information available.
Reacted by Coco R., Matthew Halloran, dtmrc, Nguyễn Quốc Thịnh and Serg
Is anyone aware of a flag that can be set to make the yarn start command log verbose output? I'd like to understand what's the underlying issue but with the existing log there isn't any information available.
@FezVrasta not sure you can do that with a flag, but you can use patch-package to remove this line from react-scripts.
Or you could try one of these methods. I don't think the FORCE_COLOR works anymore.
UPDATE:
I disabled the fast refresh using FAST_REFRESH=false
I then tried injecting it into the webpack config using customise-cra with customize-cra-react-refresh, this is the method I used before cra v4.
The outcome is the same... 👎
Anyone using a rewired cra that is experiencing this problem?
Is anyone aware of a flag that can be set to make the yarn start command log verbose output? I'd like to understand what's the underlying issue but with the existing log there isn't any information available.
@FezVrasta not sure you can do that with a flag, but you can use patch-package to remove this line from react-scripts.
Or you could try one of these methods. I don't think the FORCE_COLOR works anymore.
UPDATE:
I disabled the fast refresh using FAST_REFRESH=false
I then tried injecting it into the webpack config using customise-cra with customize-cra-react-refresh, this is the method I used before cra v4.
The outcome is the same... 👎
Anyone using a rewired cra that is experiencing this problem?
I have your problem because I've used the react-app-rewired to customize the Create-react-app and I disabled the FAST_REFRESH but I got the same issue and every time I change my code, I have to wait for about 50 seconds to see my changes in the Browser.
@jmcpeak It was my .eslintrc.js file that was making everything slow for me. This may not work for everyone but it worked for me. I ended up commenting out a few libraries from my extends list and now it is much faster:
It may be a coincidence, but running eslint . takes 20 seconds too, so it looks like CRA is running ESlint from scratch on each file change, rather than using a partial approach or some kind of cache.
This is also in line with my observations.
For example, my PR #10265 did not even receive a single comment from the maintainers.
Also the number of ignored issues and PRs seems to be devastating.
It seems that Facebook has lost interest in cra, and now the project is sailing in "minimal maintenance mode".
@mareksuscak I do agree with you though in using nextjs when it is possible as a solution, about 80% of my projects run on nextjs and vercel, but yea still has that 20% percent that is dependant on cra. It would be created to see the same interactivity from the cra team as nextjs. Both teams have been innovative but yea nextjs takes the cake if you count the progress they made and the excellent dev experience they provide 🖥️
I cut down my HMR update time a lot by using craco to have a custom start script which disables ESLint without disabling it anywhere else (editor, husky git hooks, or any other tooling).
I will check out Next.js though. Maybe it's worth switching, i've used Next.js before, and only went with CRA because i didn't need any backend for my current project.
Reacted by Riunge Maina, Bambang Mohammad Azhari, christiaankreeftmeijer, keanan, Marek Suscak, DylanCulfogienis, Dmytro Chumak, Chigozirim, Aaron Agarunov, Marcelo Gadotti and 3 more
Reacted by Riunge Maina, DylanCulfogienis, Marcelo Gadotti, Francesco Leonardi and Mety
Greetings, i was using "react-scripts": "5.0.1". For development server it is taking high ram consumption of 3-4GB. After a single change system RAM is increasing to 5 GB and the server is stopping on complete RAM consumption, saying JavaScript heap out of memory. Also the recompiling time is varying between 8-15 seconds. why is it happening like this?
Somehow, switching from yarn to npm did the trick for me (although just deleting node_modules and re-installing may have also been helpful, but I didn't think to isolate that test).
CRA is dead.
I would like to step on its grave for the sake of others.
Unfortunately I am compiled to use this horrible tool as part of a huge project.
Non of the above helped me, using 4.0.3
setting DISABLE_ESLINT_PLUGIN=true should make #9886 (comment) redundant.
I have found that the problem lies in the TS warning dumps.
Tracing back to react-dev-utils/WebpackDevServerUtils.js
Jest will die soon as well IMO.
So long facebook tools 👎
Let's hope react will make it for a few more years...
diff --git a/WebpackDevServerUtils.js b/WebpackDevServerUtils.js
index 9dda650ee..02bb745b2 100644
--- a/WebpackDevServerUtils.js+++ b/WebpackDevServerUtils.js@@ -111,6 +111,8 @@ function createCompiler({
tscCompileOnError,
webpack,
}) {
+ // kill TS dev errors and warnings+ useTypeScript = false;
// "Compiler" is a low-level interface to webpack.
// It lets us listen to some events and provide our own custom messages.
let compiler;
Activity
vlad-khitev-axon commentedon Oct 24, 2020
I have exactly the same problem. In a big TypeScript project (~1000 files) before upgrading to react-scripts@4 any code changes were applied immediately.
Any combination of
TSC_COMPILE_ON_ERRORandFAST_REFRESHenv variables doesn't affect the compilation time.balonsom commentedon Oct 24, 2020
I have the same problem, it takes around 20 seconds each time it recompiles. It was not happening on 3.4.1
jjhbw commentedon Oct 24, 2020
Same here, recompiles take several times as long as on 3.4.x
MichaelBurgess commentedon Oct 24, 2020
Same here, I can't viably use 4.0.0 as it stands. Previously I'd get a reload of page in ~2 seconds after changing some code. Now takes ~45 seconds. Initial start time is also about 3-4x slower.
ali-master commentedon Oct 24, 2020
Same here, Is there a way to solve this issue?
FezVrasta commentedon Oct 24, 2020
Is anyone aware of a flag that can be set to make the
yarn startcommand log verbose output? I'd like to understand what's the underlying issue but with the existing log there isn't any information available.paul-vd commentedon Oct 24, 2020
Having the same issue here 💤
@FezVrasta not sure you can do that with a flag, but you can use patch-package to remove this line from react-scripts.
Or you could try one of these methods. I don't think the
FORCE_COLORworks anymore.UPDATE:
I disabled the fast refresh using
FAST_REFRESH=falseI then tried injecting it into the webpack config using customise-cra with customize-cra-react-refresh, this is the method I used before cra v4.
The outcome is the same... 👎
Anyone using a rewired cra that is experiencing this problem?
ali-master commentedon Oct 24, 2020
I have your problem because I've used the react-app-rewired to customize the Create-react-app and I disabled the FAST_REFRESH but I got the same issue and every time I change my code, I have to wait for about 50 seconds to see my changes in the Browser.
jmcpeak commentedon Oct 24, 2020
I believe the problem may be related to
eslintas my IDE which runseslinton a file save is slow at this task.werevamp commentedon Oct 24, 2020
@jmcpeak It was my .eslintrc.js file that was making everything slow for me. This may not work for everyone but it worked for me. I ended up commenting out a few libraries from my extends list and now it is much faster:
RubenMateus commentedon Oct 24, 2020
Same happening with a medium size project. Upgraded to v4 and its takes a bit more time to recompile. around 5-6s,
previous was almost instant.
houmark commentedon Oct 25, 2020
I've also experienced slow recompile and the only "solution" which is of course not a solution, is to out-comment libraries/plugins.
FezVrasta commentedon Oct 25, 2020
It may be a coincidence, but running
eslint .takes 20 seconds too, so it looks like CRA is running ESlint from scratch on each file change, rather than using a partial approach or some kind of cache.61 remaining items
fkirc commentedon Jan 29, 2021
This is also in line with my observations.
For example, my PR #10265 did not even receive a single comment from the maintainers.
Also the number of ignored issues and PRs seems to be devastating.
It seems that Facebook has lost interest in cra, and now the project is sailing in "minimal maintenance mode".
paul-vd commentedon Jan 29, 2021
@mareksuscak I do agree with you though in using nextjs when it is possible as a solution, about 80% of my projects run on nextjs and vercel, but yea still has that 20% percent that is dependant on cra. It would be created to see the same interactivity from the cra team as nextjs. Both teams have been innovative but yea nextjs takes the cake if you count the progress they made and the excellent dev experience they provide 🖥️
and same this is just my personal opinion. 😉
aprilmintacpineda commentedon Feb 19, 2021
I just found out that on
.envwe can addDISABLE_ESLINT_PLUGIN=trueDungRaymond commentedon Mar 5, 2021
@aprilmintacpineda That's a nice move. Really reduced the compile time
FunctionDJ commentedon Mar 30, 2021
I cut down my HMR update time a lot by using craco to have a custom start script which disables ESLint without disabling it anywhere else (editor, husky git hooks, or any other tooling).
Install:
npm i craco -Scraco.config.js:package.json:I will check out Next.js though. Maybe it's worth switching, i've used Next.js before, and only went with CRA because i didn't need any backend for my current project.
fix: slow recompile time (react#9911)
ndukachukz commentedon Oct 8, 2021
I'm using windows and yarn start is taking more than 15 minutes to run craco start
Digiraf commentedon May 10, 2022
Adjust node_modules/react-scripts/config/webpack.config.js as mentioned here: #9886 (comment)
in my case change:
arround line 764
!disableESLintPlugin && new ESLintPlugin({to
!disableESLintPlugin && isEnvProduction &&new ESLintPlugin({You can auto patch the package using patch-package as i deed:
https://www.npmjs.com/package/patch-package
npx patch-package react-scripts
chaitanya71998 commentedon Apr 4, 2023
Greetings, i was using "react-scripts": "5.0.1". For development server it is taking high ram consumption of 3-4GB. After a single change system RAM is increasing to 5 GB and the server is stopping on complete RAM consumption, saying
JavaScript heap out of memory. Also the recompiling time is varying between 8-15 seconds. why is it happening like this?infomus commentedon May 10, 2023
Somehow, switching from
yarntonpmdid the trick for me (although just deleting node_modules and re-installing may have also been helpful, but I didn't think to isolate that test).ShaMan123 commentedon May 19, 2023
CRA is dead.
I would like to step on its grave for the sake of others.
Unfortunately I am compiled to use this horrible tool as part of a huge project.
Non of the above helped me, using 4.0.3
setting
DISABLE_ESLINT_PLUGIN=trueshould make #9886 (comment) redundant.I have found that the problem lies in the TS warning dumps.
Tracing back to
react-dev-utils/WebpackDevServerUtils.jsJest will die soon as well IMO.
So long facebook tools 👎
Let's hope react will make it for a few more years...
From your wd:
Of course you can add a flag instead using
process.envShaMan123 commentedon May 19, 2023
This is even easier
fix: slow recompile time (react#9911)
fix: slow recompile time (react#9911)
jonathasborges1 commentedon Jul 6, 2023
all work for me after add typescript in devDependencies (recompile times in (~7 seconds)
my package.json bellow