microsoft / vscode-recipes

MIT License
5.86k stars 577 forks source link

Vue.js Debug Config #222

Closed pzjzeason closed 2 years ago

pzjzeason commented 5 years ago

I create a new project by Vue Cli, and then set the launch.json in VS Code as stated in the Vue.js Cookbook:

{
  "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}/*"
      }
    }
  ]
}

But it doesn't work as expected. After I set a red breakpoint at line 40 in HelloWorld.vue and click the green play button in the Debug view, the Debugger doesn't stop at the breakpoint and the breakpoint turns to a gray circle. It's said that this breakpoint is unverified. image

I gooooogled a lot...Finally... when I change the sourceMapPathOverrides field in launch.json as follows, the Debugger works.

"sourceMapPathOverrides": {
            "webpack:///src/*": "${webRoot}/*",
        }

'./' before src is removed.

The config seems to be wrong.

gambolputty commented 4 years ago

Had the same problem. The suggested solution works! Thank you!