Visual Studio Code debugging with AngularJS

前端 未结 3 979
Happy的楠姐
Happy的楠姐 2021-01-31 23:07

I want to debug my Angular App with the new Visual Studio Code, but It seems there is a problem with Angular and Visual Studio Code..

This is my launch.json:

<         


        
3条回答
  •  一生所求
    2021-01-31 23:43

    We were using Gulp.js and had to add the following:

    "sourceMapPathOverrides": {
        "/source/*":"${workspaceRoot}/[directory where all of our mappings are located]/*"
     }
    

    Hope this helps someone who is trying to debug an angularjs app with VS Code.

    Here's a sample config:

    {
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome",
            "url": "[your url here]",
            "webRoot": "${workspaceRoot}/[directory where your app is located]",
            "sourceMaps": true,        
            "sourceMapPathOverrides": {
                "/source/*":"${workspaceRoot}/[directory where your app is located and any additional .js files that are required by your app]/*"
            },        
            "userDataDir": "${workspaceRoot}/.vscode/chrome",
            "runtimeArgs": [
                "--disable-session-crashed-bubble"
            ]
        }
    ]
    }
    

提交回复
热议问题