vscode配合Debugger for Chrome 使用配置文件注意事项

971 阅读1分钟

vscode 自带调试js工具

    调试位置打断点
    调试页面直接按 F5
    选择nodejs
    即可

vscode 结合插件 Debugger for Chrome 调试代码

  • 首先下载 插件

  • 调试页面 按 F5 选择 chrome

  • 添加配置文件 如下设置:

{
     /* 使用 IntelliSense 了解相关属性。 
      * 悬停以查看现有属性的描述。
      */ 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    
        {
          "name": "Launch localhost",
          "type": "chrome", 
          "request": "launch", 
          "url": "http://localhost/index.html", 
          "webRoot": "${workspaceFolder}/wwwroot" ,
        },
        { "name": "Launch index.html", 
          "type": "chrome", 
          "request": "launch", 
          "file": "${workspaceFolder}/index.html" 
            
        }, 
    ]
}

注意点:

${workspaceFolder} 后边添加 wwwroot 否则找不到页面

"webRoot": "${workspaceFolder}/wwwroot" ,