VS Code调试Vue.js

2019-06-27  本文已影响0人  雨季雨线

安装Debugger for Chrome插件

打个VS Code搜索Debugger for Chrome插件并安装

配置launch.json文件

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "chrome",
      "request": "launch",
      "name": "vuejs: chrome",
      "url": "http://localhost:8080",
      "webRoot": "${workspaceFolder}/src",
      "breakOnLoad": true,
      "sourceMapPathOverrides": {
        "webpack:///./src/*": "${webRoot}/*",
        "webpack:///src/*": "${webRoot}/*",
        "webpack:///*": "*",
        "webpack:///./~/*": "${webRoot}/node_modules/*"
      }
    }
  ]
}

更新webpack配置

去config/index.js并找到devtool。将其更新为:

devtool:'source-map'

开始调试

上一篇 下一篇

猜你喜欢

热点阅读