使用 Chrome、webRoot 属性调试 VS Code

Jon*_*Jon 5 node.js visual-studio-code vscode-debugger

我正在尝试调试一个简单的 node.js 项目,使用 Chrome 命中断点

C:\node 中的文件结构很简单:

node_modules(文件夹)、package.json、server.js

我已经安装了扩展“Chrome 调试器”并构建了一个 launch.json 文件

{
    "version": "0.1.0",
    "configurations": [
        {
          "type": "chrome",
          "request": "launch",
          "name": "Launch Chrome",
          "url":"http://localhost:8080/api",
          "webRoot": "${workspaceFolder}",   
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

但是它不会遇到 server.js 文件中的断点。

我认为问题在于 webRoot 属性。

经过大量阅读和反复试验后,我最终无法弄清楚这一点。

任何帮助将不胜感激