如何在Visual Studio代码中调试客户端?

时间:2017-06-22 11:29:33

标签: debugging visual-studio-code

根据Microsoft Documentation,Visual Studio Code调试器应该能够调试typescript和javascript。

问题是,它们仅使用node或python为服务器端应用程序提供示例。 Intellisense仅建议服务器语言。

是否可以使用Visual Studio Code调试器调试客户端打字稿或javascript应用程序?

launch.json

{
    // Use IntelliSense to learn about possible Node.js debug attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "type":"node"      <-- what if I'm building a JS / TS app?
            "request": "launch",
            "name": "Launch Program",
            "program": "${file}",
            "outFiles": [
                "${workspaceRoot}/out/**/*.js"
            ]
        }
    ]
}

1 个答案:

答案 0 :(得分:3)

您必须安装一个(或多个)浏览器调试程序扩展程序:ChromeFirefoxiOS WebEdge

然后您可以对Chrome使用这样的启动配置:

{
    "type": "chrome",
    "request": "launch",
    "name": "Launch Chrome",
    "url": "http://localhost:8080",
    "webRoot": "${workspaceRoot}"
}

根据您构建的工作流程,您可能需要执行一些其他步骤才能使源地图生效。

相关问题