简体   繁体   English

VS2017需要很长时间才能在保存时重新编译打字稿

[英]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. 我有一个ASP.Net项目,其中一些TypeScript通过NPM @types使用D3 / SignalR / Lodash。

Up until last week we were using VS2015 and there were no issues. 直到上周我们使用VS2015并没有问题。 I was very impressed with compilation times, actually, since my earlier sandbox environment was in Sublime and that took ~4 seconds to build. 实际上,我对编译时间印象非常深刻,因为我早期的沙盒环境是Sublime,需要大约4秒才能构建。 VS2015 seemed to do it near-instantly on save, so I was very happy with that. VS2015似乎在保存时几乎立刻就做到了,所以我对此非常满意。

Now we have upgraded to VS2017, and saving has become a huge problem. 现在我们已升级到VS2017,节省已成为一个巨大的问题。 Saving takes 30+ seconds, as the TypeScript compiler now slowly goes through each of the type definition files (d3, lodash, signalR, etc.). 保存需要30多秒,因为TypeScript编译器现在慢慢地遍历每个类型定义文件(d3,lodash,signalR等)。 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. 即使我做了最微小的改变,比如修改字符串中的拼写错误,或者更改int常量,重新编译仍需要30秒以上。 Actually, I think it even recompiles even if I just press CTRL+S without even making any changes. 实际上,我认为它甚至可以重新编译,即使我只是按CTRL + S而不做任何修改。

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. 我已经看了这个,显然“从VS2015开始”编译保存现在需要完全重新编译。 I don't know what's changed, but there is a MASSIVE difference since upgrading from VS2015 to VS2017. 我不知道发生了什么变化,但自从VS2015升级到VS2017后,存在巨大的差异。

Here is my tsconfig.json file: 这是我的tsconfig.json文件:

{
  "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. 我最近补充说,排除node_modules希望它能解决问题,但它似乎没有任何区别。

Any ideas? 有任何想法吗? Thanks. 谢谢。

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 https://developercommunity.visualstudio.com/content/problem/10762/typescript-background-compilation-too-often-causes.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM