首页 > 解决方案 > VSCode - Chrome 调试 - 未验证的断点

问题描述

我在调试 .ts 文件中的角度组件时遇到问题。我正在为 Chrome 扩展使用 VSCode 和调试器。

这是我的 vscode 启动文件:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome",
            "url": "http://localhost:5000",
            "sourceMaps": true, 
            "webRoot": "${workspaceRoot}"        
        }
    ]
}

这是我的 tsconfig.json 文件:

{
  "compile": true,
  "comments":true,
  "module": "none",
  "target": "es5",
  "sourceMap": true,
  "sourceRoot": "",
  "mapRoot": "",
  "declaration": false
}

在角度组件内部,我在 $onInit 循环中设置了一个断点:

$onInit = () => {
  for(let i = 0; i < 5; i++) { //here I put breakpoint
    let t = i;
  }
}

Debus 成功启动(chrome 打开)但没有任何反应。在我的编辑器中,如果我将鼠标悬停在断点上,工具提示会显示一条消息:未 验证的断点。已设置断点但尚未绑定

我正在使用 1.24.1 版本的 vscode。

标签: javascriptvisual-studio-code

解决方案


使用时Visual Studio Code > Open Folder...,请确保打开所在的文件夹package.json


推荐阅读