3

I configured a Vue.js project with Electron using Electron Builder and I can1t debug it. If I run my electron:serve script (which calls vue-cli-service electron:serve) in "Run and Debug" of VS it runs my app correctly, but sets the breakpoints of my main file (background.js), and any other, as unbound, as you can see in the image bellow:

enter image description here

I tried also to set launch.json with a "node.js electron main" config. But when I run debugger with this config it doesn't find the electron app at main.js, probably because main.js is a vue app.

    {
  "version": "0.2.0",
  "configurations": [
    {
        "name": "Electron Main",
        "program": "${workspaceFolder}/main.js",
        "request": "launch",
        "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron",
        "skipFiles": [
            "<node_internals>/**"
        ],
        "type": "node"
    },

enter image description here

And if I exchange the main.js in this config to background.js it also doesn't find.

I set breakpoint at background.js line 13. And in main.js also.

I tried this config of launch.json also. Note that in cwd I have the path to my src folder, where I have the electron file, background.js, and stills it says that it did not find. I tried without the / after src also:  enter image description here

Here's my repository.

Lucas
  • 157
  • 1
  • 12
  • I'm not sure what you mean by unbound and the image doesn't clarify that for me. can you clarify? – Slbox Aug 04 '22 at 23:43
  • 1
    I'm not sure. I think that it might mean that the breakpoint is ignored by the Vue.js server, for a reason that I don't know. This post (https://stackoverflow.com/questions/62384636/debugging-vue-in-vscode-and-chrome-unbound-breakpoint) might help. Later I'll try to implement the changes suggested there – Lucas Aug 13 '22 at 12:18
  • Try putting a debugger line at the very top of the file in whatever process you need to debug (I'm guessing `main` from your question text). Sometimes Electron likes to skip breakpoints, but it won't if you put a `debugger;` call at the top of the entry point (the first file you call that loads the rest) – Slbox Aug 13 '22 at 18:35

0 Answers0