question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to switch to the version with fast TypeScript compilation?

See original GitHub issue

Both #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:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
deftomatcommented, Mar 1, 2019

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.

0reactions
TomasHubelbauercommented, Mar 1, 2019

@deftomat Is most of the slowness due to tsc itself then? I am really surprised to see how slow TS CRA is because on pure tsc 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript Compiling with Visual Studio Code
Use this to switch between the version of TypeScript that comes with VS Code and the version of TypeScript in your workspace. You...
Read more >
How to speed up your TypeScript project? - The Software House
In its raw form, running the `npm run watch` command (which starts the TypeScript Compiler – tsc – in a watch mode) takes...
Read more >
Documentation - tsc CLI Options - TypeScript
Flag Type Default ‑‑allowJs boolean false ‑‑allowUmdGlobalAccess boolean false ‑‑allowUnreachableCode boolean
Read more >
Is there any option to compile and run a ts code faster using ...
I just replace any ts-node occurrence with sucrase-node to get roughly a 20x speed boost in my testing. It does not need environment...
Read more >
Optimizing TypeScript - Wallaby.js
This brings the average compile time down to 9.09 seconds , a 32% reduction in time (not bad for a quick setting change)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found