相关疑难解决方法(0)

使用Visual Studio代码进行调试无效

我希望能够使用Visual Studio Code调试Angular2应用程序.

这是我的环境:

  • 操作系统:Ubuntu 16.10 x64
  • 浏览器:Chromium 53.0.2785.143
  • 节点:6.8.0
  • Angular-cli:1.0.0-beta.19-3

使用angular-cli创建一个新项目:

ng new test-VSC-debug
cd test-VSC-debug
Run Code Online (Sandbox Code Playgroud)

然后我打开VSC并加载项目: File/open folder

我点击debug的标志,我configure launch.json的选择chrome.它生成以下文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Chrome against localhost, with sourcemaps",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:8080",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        },
        {
            "name": "Attach to Chrome, with sourcemaps",
            "type": "chrome",
            "request": "attach",
            "port": 9222,
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

然后我通过运行启动angular2项目:

ng serve …
Run Code Online (Sandbox Code Playgroud)

google-chrome-devtools visual-studio-code angular-cli angular

17
推荐指数
2
解决办法
2万
查看次数