在 vscode 调试(debug) vue js 代码的配置

参考资料
https://vuejs.bootcss.com/cookbook/debugging-in-vscode.html
https://blog.csdn.net/yezonggang/article/details/110070915 按这个也不能进入断点,需要在 launch.json 加多1行

  1. 配置vue有源码,找到这个段即可,可能在 vue.config.js 或 webpack里面
    configureWebpack: {
    devtool: 'source-map',
    },

  2. 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": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:8080",
            "webRoot": "${workspaceFolder}/src",
            "breakOnLoad": true,
            "sourceMapPathOverrides": {
                "webpack:///./src/*": "${webRoot}/*",
                "webpack:///src/*": "${webRoot}/*"
            }
        }
    ]
}
posted @ 2021-11-21 15:48  正版软件开发  阅读(292)  评论(0编辑  收藏  举报