在WebStorm 7中调试时未打到Typescript断点

时间:2022-06-21 10:38:46

I am using Typescript SDK 0.9.1.1 and WebStorm 7. I have a .ts file with a file watcher transpiling its .js and sourcemap files. I also have an HTML file that looks like this...

我正在使用Typescript SDK 0.9.1.1和WebStorm 7.我有一个带文件监视器的.ts文件来转换它的.js和源映射文件。我还有一个看起来像这样的HTML文件......

<!DOCTYPE html>
<html>
<head></head>
<body>
    <p id="output">5</p>
    <script src="HelloWorld.js"></script>
    <script>
        var u = new Utils();
        document.getElementById('output').innerHTML = u.plusOne(5);
    </script>
</body>
</html>

The plusOne function simply takes the number (in this case, 5) and returns that number plus one. My page, javascript and Typescript work fine, because the page says "6" when loaded.

plusOne函数只接受数字(在本例中为5)并返回该数字加1。我的页面,javascript和Typescript工作正常,因为页面在加载时显示“6”。

I can set breakpoints in the .js file and they are hit (showing me the Typescript file's equivalent line) but if I set breakpoints in the original .ts file they are not. I've searched for this issue but my problem seems different from others' - I am running locally (not remotely) and I am setting the breakpoints in WebStorm, not Chrome's debug view.

我可以在.js文件中设置断点并且它们被命中(向我显示Typescript文件的等效行)但是如果我在原始.ts文件中设置断点则它们不是。我已经搜索过这个问题,但我的问题似乎与其他问题不同 - 我在本地运行(不是远程)我在WebStorm中设置断点,而不是Chrome的调试视图。

In WebStorm, the Scripts tab shows only the .js and .html files. Should I be seeing more here? If that's the problem, how do I fix it? I've opened the debug configuration but I don't see a way to add the .ts file there.

在WebStorm中,“脚本”选项卡仅显示.js和.html文件。我应该在这里看到更多吗?如果这是问题,我该如何解决?我打开了调试配置,但我没有看到在那里添加.ts文件的方法。

1 个解决方案

#1


1  

Turns out this is due to an open bug in WebStorm. In practical terms, the workaround is to reload the HTML page from the browser (which is NOT the same as rerunning the HTML page in debug mode from WebStorm). If you do that then the breakpoints in the .ts file will be hit.

事实证明这是由于WebStorm中存在一个漏洞。实际上,解决方法是从浏览器重新加载HTML页面(这与从WebStorm以调试模式重新运行HTML页面不同)。如果这样做,那么.ts文件中的断点将被命中。

#1


1  

Turns out this is due to an open bug in WebStorm. In practical terms, the workaround is to reload the HTML page from the browser (which is NOT the same as rerunning the HTML page in debug mode from WebStorm). If you do that then the breakpoints in the .ts file will be hit.

事实证明这是由于WebStorm中存在一个漏洞。实际上,解决方法是从浏览器重新加载HTML页面(这与从WebStorm以调试模式重新运行HTML页面不同)。如果这样做,那么.ts文件中的断点将被命中。