简体   繁体   English

节点打字稿客户端调试

[英]node typescript client-side debug

Is is possible to debug (breakpoints, watches) client-side .ts typescript files from visual studio (2015) directly ? 是否可以直接从Visual Studio(2015)调试(断点,监视) 客户端 .ts打字稿文件? Most of the related issues that I have found on google and stackoverflow suggest using other browser devtools such as chrome. 我在google和stackoverflow上发现的大多数相关问题都建议使用其他浏览器devtool,例如chrome。 Is it possible to do it in visual studio? 是否可以在Visual Studio中进行?

When I create a .ts script (say index.ts), it will be transpiled into a index.js which will then be referenced from the corresponding index.html file in the script tag. 当我创建一个.ts脚本(例如index.ts)时,它将被转换为index.js,然后从script标记中的相应index.html文件中对其进行引用。

How can I set breakpoints in the .ts file (although it is the .js which is referenced?) 我如何在.ts文件中设置断点(尽管引用的是.js?)

It is possible with IE. IE有可能。 You have to set "Browse with" to Internet Explorer and in the project properties/web unchecked all debuggers. 您必须将“浏览方式”设置为Internet Explorer,并在项目属性/网站中取消选中所有调试器。 Than you should be able to debug client-side TS in VS. 比您应该能够在VS中调试客户端TS。

I figured out that I can debug in visual studio but launching aa new debug session from internet explorer: menu->view->external script debugger which will start a new visual studio ide with all my files (.js and .ts mapped) loaded. 我发现可以在Visual Studio中进行调试,但是可以从Internet Explorer启动一个新的调试会话:菜单->视图->外部脚本调试器,它将启动一个新的Visual Studio IDE,并加载我的所有文件(映射的.js和.ts) 。 I just have to make sure that the .js and .ts files are in the same directory (example: ./public/js/ ). 我只需要确保.js和.ts文件位于同一目录(例如:./public/js/)。 It is not a perfect solution (for example bringing the cursor over a variable does not show the variable value. You must manually open the watch window...) But it allows me to step through my .ts files thus keeping a unified development environment: typescript with node.js on the server, typescript on the client-side within the same solution 这不是一个完美的解决方案(例如,将光标移到变量上不会显示变量值。您必须手动打开监视窗口...)但是,它允许我逐步浏览.ts文件,从而保持统一的开发环境:在服务器上带有node.js的打字稿,在同一解决方案中在客户端打字稿

You might try with this HTML Application with TypeScript project template from Web Essentials 2015 extension, as suggested in this post from Telerik blog. 您可以尝试使用Web Essentials 2015扩展中的带有TypeScript项目模板的HTML应用程序 ,如Telerik博客中的这篇文章中所建议的那样。

If that works, it seems just a matter of usual VS scenario "set breakpoint; hit F5". 如果可行,这似乎只是通常VS场景“设置断点;按F5”的问题。

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

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