使用vs code与microsoft edge调试webpack项目

  1. webpack的配置要开启mapsource输出
devtool: 'source-map',

2.安装vs code的插件Debugger for Microsoft Edge

3.启动调试生成launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "edge",
            "version": "stable",
            "request": "launch",
            "name": "针对 localhost 启动 Edge",
            "url": "http://localhost:8088",
            "webRoot": "${workspaceFolder}",
            "sourceMapPathOverrides": {
                "webpack:///./~/*": "${webRoot}/node_modules/*",       // Example: "webpack:///./~/querystring/index.js" -> "/Users/me/project/node_modules/querystring/index.js"
                "webpack:///./*":   "${webRoot}/*",                    // Example: "webpack:///./src/app.js" -> "/Users/me/project/src/app.js",
                "webpack:///*":     "*",                               // Example: "webpack:///project/app.ts" -> "/project/app.ts"
            }
        }
    ]
}

愉快的调试吧·

posted @ 2020-03-12 17:02  新房客  阅读(1744)  评论(0编辑  收藏  举报