vscode 调试 react 项目

主要分为以下三个步骤

  1. 安装 debug for chrome
  2. 配置 launch.json 文件

    配置内容如下

{
    "version": "0.2.0",
    "configurations": [{
        "type": "chrome",
        "request": "launch",
        "name": "Launch Chrome",
        "url": "http://localhost:3000",  // 改为目标 url
        "sourceMaps": true,
        "webRoot": "${workspaceFolder}",
        "skipFiles": [
            "node_modules/**"
        ],
        "sourceMapPathOverrides": {
            "webpack:///*": "${webRoot}/*"
        }
    }]
}

3 使用 npm 启动项目, 关掉弹出的浏览器页面

4 打断点,在 Debug 模块启动调试

本配置参考 csdn 博客进行配置,详细链接在此 链接

posted on 2019-10-05 16:31  张居斜  阅读(6481)  评论(0编辑  收藏  举报

导航