I have the following as my launch.json file
{
"version": "0.2.0",
"configurations": [
{
"name":"Launch vite:dev",
"request": "launch",
"type": "node",
"runtimeExecutable": "npm",
"args": ["run","vite:dev"]
},
{
"name":"Launch electron",
"request": "launch",
"type": "node",
"runtimeExecutable": "npm",
"args": ["run","electron"],
},
{
"name": "Attach electron",
"request": "attach",
"type": "chrome",
"port": 9223,
}
],
"compounds": [
{
"name": "Dev",
"configurations": ["Launch vite:dev","Launch electron","Attach electron"],
"stopAll": true
}
]
}
This allows me to launch my electron app using vite, and debug the app. For code running on the main thread this works as expected, I can step through the code in vscode.
However for scripts running in the renderer thread, I’m getting poorer results. If I put a breakpoint in a .vue file it doesn’t map exactly to the correct source line, but it does work to step over. This is annoying, but I can live with it.
The bigger issue I am having is with .js files. If a add a breakpoint in vs code it looks like it hasn’t worked, but when the code actually executes it does stop at the exact right point, but in a different file prefixed with “127.0.0.1:3000” instead of my working directory. The file name is the same, and I can add more breakpoints and step correctly in this new file, but this new file is readonly, additionally if I stop and restart the debug session it creates a new file with the same “127.0.0.1:3000” prefix, but it is now yet another new tab in vscode…
I’ve tried adding
"pathMapping": {
"/" : "${workspaceFolder}"
}
to my attach request, and numerous other things like the full “127.0.0.1:3000” file path to a particular file, but nothing has given me so much as an error message.
Is there a way to get a debug log, or somehow dig a little deeper to figure out how to get vscode to remap the paths correctly?
Thanks in advance