1、参考在 VS Code 中调试 — Vue.js

2、安装Debugger for Chrome

3、vue.config.js

configureWebpack: {
	devtool: 'source-map'
},

 4、launch.json

端口与vue.config.js中的port一致

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

5、运行

npm run dev

6、下断点,并启动调试

 7、命中断点

Logo

前往低代码交流专区

更多推荐