1

步骤一:安装Debugger for Chrome插件
debugger.png

步骤二:配置launch.json

"version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Program",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:4200",
            "sourceMaps": true,
            "webRoot": "${workspaceRoot}",
            "trace": true,
            "userDataDir": "${workspaceRoot}/.vscode/chrome",
            "runtimeExecutable": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
        }
    ]

注:runtimeExecutable配置项为chrome安装位置
步骤三:ng serve启动项目
步骤四:以Debugger方式在浏览器运行项目
debugger.gif


菜鸟专家
17 声望5 粉丝

不会写BUG的菜鸟专家