How to switch to the version with fast TypeScript compilation?
See original GitHub issueBoth #5903 and #6406 got silenced and from the last comment in the latter it looks like the work on async TypeScript compilation has been completed, but I don’t know how to tell if I am running the fast version already. My current CRA+TS setup is certainly not fast.
Is it enough to update react-scripts
? To what version? Do I need to update the whole or create-react-app
when wanting to create a new project with fast TypeScript compilation? What about an existing project? How do I update that to have fast TypeScript compilation?
I am using react-scripts
v2.1.5 on a very shitty machine and compilation takes forever. Is it fast yer and am I to blame the machine or am I not fast yet and should I pursue updating?
For me, npm start
from issuing the command to seeing Compiled successfully! takes two minutes and 20 seconds. The machine is an i7-3667U 2 GHz CPU with 8 GB of RAM. skipLibCheck
is set to true
. Not exactly a beast, but the project I am compiling is very small, I don’t believe it should take two and a half minutes for it to compile.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Cold starts are generally quite slow. I’m pretty sure that during the cold start (when you start
npm start
), TypeScript is not a bottleneck. Most of that time is probably Babel and Webpack itself.As an example,
npm start
took 40 seconds on my machine and then the next rebuild caused by updated code took 3 seconds. When I applied changes from mentioned PRs, start took the same 40 seconds but rebuilds took less than a second.So yes, starting the CRA is slow, but I must admit that I don’t need to restart the build process for the whole workday.
@deftomat Is most of the slowness due to
tsc
itself then? I am really surprised to see how slow TS CRA is because on puretsc
projects I have never had a compilation run for more than thirty seconds and I am even stretching that. With the way CRA uses TS it is 5x as slow. Have I just been lucky to not find this with pure TS? I am completely blind to what WebPack, Babel etc. do on this front and how much overhead is due to them, that’s why I am curious.