I am developing a Vue.js web app (Vue 2) in Visual Studio Code and using the chrome debugger extension. I set this up many months ago following the advice from this SO post: visual-studio-code-breakpoint-appearing-in-wrong-place
Everything was working completely fine until the latest VS Code update (Version: 1.47.0) got pushed a few days ago. Now debug points appear in the wrong place in the code, just like the previously linked post.
In the example gif below, the debugger will never stop at the break points that I actually click. The break point jumps to line 40, and that is the only point that actually breaks when debugging. The debugger will never stop at line 142, 147, 150... only line 40 (which was never set by me).
Here is the .vscode/launch.json
configuration that has worked for the past several months:
{
"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:///./*": "${webRoot}/*",
"webpack:///*": "*",
"webpack:///./~/*": "${webRoot}/node_modules/*",
}
}
]
}
UPDATE
I had wondered if something in my workflow (such as switching git branches) was the cause of trouble, but this seems not to be the case. I have been working on the same git branch for a week and cannot set breakpoints in several .vue files.
UPDATE 2021 November
I'm currently debugging a Vue/Electron app. The app loads a page with no components, and I want to debug components that are loaded later. I'm noticing that breakpoints that are set before the initial load don't work. But if I set a break point in a component AFTER that component has been loaded, it seems to work.
Not sure if this will hold true for all Vue debugging, or if it is specific to Vue/Electron, but I wanted to leave the note in case a pattern emerges.