首页 > 其他 > 详细

VScode debug React config

时间:2020-06-02 00:23:39      阅读:51      评论:0      收藏:0      [点我收藏+]

1. 安装 VScode 插件 Debugger for Chrome

技术分享图片

2. 配置 webpack

webpack.config.js 添加 source map

+ devtool: ‘eval-cheap-module-source-map‘,  // 或者 ‘eval-source-map‘

3. 配置 .vscode/launch.json

按 F5 选择 chrome,会生成 .vscode/launch.json 修改如下

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "Launch Chrome against localhost",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}",
      "sourceMaps": true,
      "sourceMapPathOverrides": {
        "webpack:///./*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///*": "*",
        "webpack:///./~/*": "${webRoot}/node_modules/*",
        "meteor://??app/*": "${webRoot}/*"
      }
    }
  ]
}

然后就可以 按 F5 调试项目了。


whosmeya.com

VScode debug React config

原文:https://www.cnblogs.com/whosmeya/p/13028551.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!