在使用 Typescript 和 Visual Studio 2015 运行时进行编辑? [英] Edit while running with Typescript and Visual Studio 2015?

查看:18
本文介绍了在使用 Typescript 和 Visual Studio 2015 运行时进行编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 2013 中使用 Typescript 时,我似乎记得我可以在浏览器窗口中运行时编辑 TypeScript 源代码,然后刷新浏览器窗口并获得新的更改.

现在,在 Visual Studio 2015 中,Visual Studio 在浏览器窗口打开时禁用编辑.这意味着一旦我想编辑源代码,我就必须停止并重新启动.这对我来说似乎很愚蠢,因为它需要做的就是重新编译源代码,无论如何它都会这样做.:)

有什么办法可以解决这个问题吗?

解决方案

我最近为我一直在从事的一些项目解决了这个问题,并希望分享我所做的事情,以防对其他人有所帮助.

>

我最终意识到在调试模式下更新 TypeScript 文件后会从 JS 文件中删除源映射引用,例如:

//# sourceMappingURL=View.js.map

一旦我有了这个发现,我就能够找到一个错误记录,在这里找出解决问题的步骤:

我希望这对其他人和我一样有帮助:)

While using Typescript with Visual Studio 2013, I seem to recall that I could edit TypeScript source while running it in a browser window, then refresh the browser window and get the new changes.

Now, in Visual Studio 2015, Visual Studio disables editing while the browser window is open. That means I have to stop and restart once I want to edit the source. This seems pretty stupid to me since all it would need to do is recompile the source, which it does all the time anyways. :)

Is there any way to fix this?

解决方案

I recently fixed this issue for a number of projects I've been working on and wanted to share what I did just in case it helps anyone else.

I eventually realised that after updating a TypeScript file whilst in debug mode would remove the source map reference from the JS file e.g:

//# sourceMappingURL=View.js.map

Once I made this discovery I was able to find a bug logged for it figure out the steps to resolve the issue here:

https://github.com/Microsoft/TypeScript/issues/5001

In summary what I did was right click the project file in Visual Studio, went to the TypeScript tab and un-ticked and re-ticked the option 'Generate source maps' (see below image) and then saved the project file.

I hope this helps others as much as it has me :)

这篇关于在使用 Typescript 和 Visual Studio 2015 运行时进行编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆