Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017 takes long time recompiling typescript on save

I've got an ASP.Net project with some TypeScript making use of D3/SignalR/Lodash via NPM @types.

Up until last week we were using VS2015 and there were no issues. I was very impressed with compilation times, actually, since my earlier sandbox environment was in Sublime and that took ~4 seconds to build. VS2015 seemed to do it near-instantly on save, so I was very happy with that.

Now we have upgraded to VS2017, and saving has become a huge problem. Saving takes 30+ seconds, as the TypeScript compiler now slowly goes through each of the type definition files (d3, lodash, signalR, etc.). Even if I make the tiniest change, like fixing a typo in a string, or change an int constant, it still takes 30+ seconds to recompile. Actually, I think it even recompiles even if I just press CTRL+S without even making any changes.

The status down the bottom is:

Generation of '[...]' complete. Remaining files still compiling.

I've looked this up already, and apparently "starting with VS2015" compile-on-save now requires a full recompilation. I don't know what's changed, but there is a MASSIVE difference since upgrading from VS2015 to VS2017.

Here is my tsconfig.json file:

{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": true,
    "removeComments": true,
    "preserveConstEnums": true,
    "alwaysStrict": true,
    "out": /* out */,
    "sourceMap": true
  },
  "files": [
    /* files */
  ],
  "exclude": [
    "node_modules"
  ]
}

I recently added that exclude node_modules hoping it would fix the problem, but it doesn't seem to have made any difference.

Any ideas? Thanks.

like image 424
Ozzah Avatar asked Mar 13 '17 22:03

Ozzah


1 Answers

Seems to be reported as an issue. It is under investigation at the moment. I have the same problem. Really annoying. https://developercommunity.visualstudio.com/content/problem/10762/typescript-background-compilation-too-often-causes.html

like image 131
user1540857 Avatar answered Sep 30 '22 18:09

user1540857