Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typescript compilation becomes slow - WebStorm

Since some days I see that the typescript compilation is becoming slower and slower. Compile a single file with webstorm file watcher took me around 1-4 sec, but I added many TS files (75 now, and I think that's not really a lot...) and the compilation time is about 10sec for a simple file.

If I need to change of branch or update a definition, it can become around 5 minutes. My computer is really powerful (game computer) and I don't get why it's becoming slow like that.

All files are compiled one by one, the webstorm way... And if the server is running at the same time with a watcher, it becomes crazy because restart maybe 50 times. (Obviously, I shut it down, but it's not really useful to have a watcher if I need to shut it down...)

Any idea? I took a look to several discussions like mine but so far I didn't really found any workaround.

like image 580
Vadorequest Avatar asked Nov 10 '22 13:11

Vadorequest


1 Answers

You could point the file watcher to grunt task that compiles all your files in a single pass. E.g. grunt-ts : https://github.com/basarat/grunt-ts compiles all your files in one command to tsc.

PS disclosure: I am one of the authors of grunt-ts

like image 61
basarat Avatar answered Nov 14 '22 22:11

basarat