首页 文章

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

提问于
浏览
0

根据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 回答

  • 2

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

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

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

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

相关问题