Typescript 调试在 Visual Studio 2017 中不起作用 [英] Typescript debugging not working in Visual Studio 2017

查看:48
本文介绍了Typescript 调试在 Visual Studio 2017 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 Visual Studio 2017 版本 15.5.7 用于我的 .NET Web API 项目,并且我将 Syncfusion 的角度控件与 systemJS 一起用于 UI.问题是,我根本无法调试打字稿.我可以放置一个断点,它看起来像正常的常规断点,直到我点击调试,然后它变得不可用并显示消息:

I'm using Visual Studio 2017 version 15.5.7 for my .NET web API project and I'm using Syncfusion's angular controls with systemJS for UI. Problem is, that I cannot debug typescript at all. I can place a breakpoint and it appears like normal regular breakepoint until i hit debug, then it becomes unavailable with message:

当前不会命中断点.尚未为此代码位置加载代码.

The breakpoint will not currently be hit. No code has been loaded for this code location.

我尝试使用 Chrome、Firefox、Edge 和 IE 进行调试,但无济于事..map 文件在构建时生成,我可以在 Chrome 开发工具中调试转译的 javascript 文件.另外,我应该提到我无法在 Chrome 中导航到我的打字稿文件.刚刚生成的javascript文件.

I tried debugging with Chrome, Firefox, Edge and IE, but to no avail. .map files are generated on build and I can debug transpiled javascript files in Chrome dev tools. Also, I should mention that I cannot navigate to my typescript files in Chrome. Just generated javascript files.

更新:

我还应该提到 Web 项目 Properties -> TypeScript Build 中的所有选项都被禁用,并且有一条消息:

I should also mention that all of the options in web project Properties -> TypeScript Build are disabled and there's a message:

检测到一个或多个 tsconfig.json 文件.项目属性被禁用.

One or more tsconfig.json files detected. Project properties are disabled.

我只添加了一个 tsconfig.json 文件.VS 使用一些内部的吗?这可能是个问题吗?我的 node_modules 文件夹中还有一些 tsconfig.json 文件.

I have added only one tsconfig.json file. Is VS using some internal one? Could this be a problem? Also there are some more tsconfig.json files in my node_modules folder.

推荐答案

最简单的方法是内联映射,这样即使打包也能工作.在 tsconfig 中尝试以下设置:

Easiest thing to do is inline the mapping, so that even packing works. try the following settings in your tsconfig:

//"sourceMap": true,
"inlineSourceMap": true,
"inlineSources": true,

这篇关于Typescript 调试在 Visual Studio 2017 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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