我正在使用Edge extension。以下是launch.json中的配置:

"configurations": [
    {
      "name": "ng serve",
      "type": "edge",
      "request": "launch",
      "url": "http://localhost:4200/",
      "webRoot": "${workspaceFolder}",
      "sourceMaps": true
    }]

根据VS Code中的文档,这是更详细的步骤:
  • npm install -g @ angular/cli,ng新的my-app
  • 安装Edge extension
  • 重新加载项目
  • npm启动
  • 转到“调试” View (Ctrl + Shift + D)并单击齿轮按钮以创建launch.json调试器配置文件。从“选择环境”下拉列表中选择“Chrome”。使用上面launch.json中显示的代码更新配置。
  • 在app.component.ts中设置断点
  • 按F5键-现在应该达到断点了。但是在断点悬停时收到消息-“未验证的断点”。断点没有被击中。

  • 我尝试清除所有断点,重新启动vs代码(和计算机),关闭所有浏览器实例,但是仍然得到相同的行为。调试器能够在浏览器中启动angular应用程序,但无法达到断点。

    因此,是否有其他配置可以使其与Edge浏览器一起使用。
    当前配置在chrome浏览器中可以正常工作(只需在launch.json中将edge替换为chrome)。

    最佳答案

    现在,此配置似乎对我有用。
    它在断点处中断并显示为可用。

     {
            "name": "Edge",
            "type": "edge",
            "request": "launch",
            "url": "http://localhost:4200/#",
            "webRoot": "${workspaceFolder}",
            "sourceMaps": true,
            "trace": true,
            "userDataDir": "${workspaceRoot}/.vscode/edge"
        }
    

    我猜他们做了一些修复。

    关于angular - 如何使用Edge浏览器在VSCode中调试Angular应用程序?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50013884/

    10-10 20:02