VS2015 Typescript 在保存时编译为单个文件不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31559653/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:02:53  来源:igfitidea点击:

VS2015 Typescript compile to single file on save not working

typescriptvisual-studio-2015

提问by Denis Thomas

I have trouble with VS 2015 and Typescript compile on save. If I enable combine all outputs into one file that output file will not be updated on save. During build the file gets updated correctly. Some times there is an error message in the status bar which states the .map file can't be written. If i disable the one file option compile on save is working.

Is there any option to enable some logging so I could figure out what is going wrong?

我在 VS 2015 和 Typescript 编译时遇到问题。如果我启用将所有输出合并到一个文件中,则输出文件将不会在保存时更新。在构建过程中,文件得到正确更新。有时,状态栏中会显示一条错误消息,指出无法写入 .map 文件。如果我禁用一个文件选项,则保存时编译正在运行。

是否有任何选项可以启用某些日志记录,以便我可以弄清楚出了什么问题?

Update:I was able to reproduce this with a new clean Project and also on another PC of a collegue with a completeely different existing project. So this seems to be a general bug.

更新:我能够使用一个新的干净项目以及在另一台拥有完全不同现有项目的同事的 PC 上重现此内容。所以这似乎是一个普遍的错误。

采纳答案by sergpy

Yes, I reproduced this too

是的,我也复制了这个

You need to set full path for JavaScript file

您需要为 JavaScript 文件设置完整路径

回答by Simon_Weaver

This has been fixed.

这已被修复。

Go to Extensions and Updates. Update to version 1.5.4or above and it should work.

Extensions and Updates。更新到版本1.5.4或更高版本,它应该可以工作。

The upgrade process is a little odd because a new Visual Studio installer will appear on top of the current instance. Close the Visual Studio underneath and then continue with the update to avoid conflicts.

升级过程有点奇怪,因为一个新的 Visual Studio 安装程序将出现在当前实例的顶部。关闭下面的 Visual Studio,然后继续更新以避免冲突。

It took quite a surprising length of time (over a minute) to apply the update but it works fine now.

应用更新花费了相当长的时间(超过一分钟),但它现在工作正常。

Note: When making a .tsfile to then save change you must make a real code change, not just type something, delete it and save or it won't be recognized.

注意:当创建一个.ts文件然后保存更改时,您必须进行真正的代码更改,而不仅仅是键入某些内容,将其删除并保存,否则将无法识别。

enter image description here

在此处输入图片说明

回答by Simon_Weaver

Full path is fine until you have to start building on different machines.

完整路径很好,直到您必须在不同的机器上开始构建。

I for instance use R:\TFS-PROJECTSon my local machine but C:\TFS-PROJECTSon the TFS server (which also builds the typescript).

例如R:\TFS-PROJECTS,我在我的本地机器C:\TFS-PROJECTS上使用,但在 TFS 服务器(它也构建打字稿)上使用。

As a temporary solution I'm using junction.exeto make symbolic link (run as admin).

作为临时解决方案,我使用junction.exe符号链接(以管理员身份运行)。

junction c:\TFS-PROJECTS r:\TFS-PROJECTS

That way I can just use the same full path. If you have vastly different hierarchies you could use C:\PROJECT1-ROOTand point that wherever you need.

这样我就可以使用相同的完整路径。如果您有截然不同的层次结构,您可以使用它C:\PROJECT1-ROOT并将其指向任何需要的地方。

enter image description here

在此处输入图片说明

Junction is a sysinternals program available for Microsoft :https://technet.microsoft.com/en-us/sysinternals/bb896768

Junction 是 Microsoft 可用的 sysinternals 程序:https: //technet.microsoft.com/en-us/sysinternals/bb896768

Hoping a fix for this regression bug will be deployed soon.

希望尽快部署此回归错误的修复程序。