debugging electron/vue/typescript

Hi there, I have had no luck with other suggestions around setting up debugging for vue or typescript. My project is a vue electron typescript app created with vue cli 3 that I want to be able to use breakpoints for.

I am using Webstorm 2019.3 on OSX 10.14.6  

I normally run the app using `npm run electron:serve` which runs `vue-cli-service electron:serve`

If I run debug without changes I get a blank app and it says dev tools has been disconnected and I should refresh, which does nothing

In `tsconfig.json` I have `"inlinesSources": true, "sourceMap": true`

I have tried editing my npm Run/Debug configuration to use the project's Node interpreter but this complains about adding `$NODE_DEBUG_OPTION` which does not apply as I am using npm to run `vue-cli-service` and not node

So I tried adding a Node configuration with the project electron interpreter but it complains about the main entry point in package.json that was not previously required. If I edit this from background.js to the correct src/background.ts I get compile errors

Anyone have some advice here? I have put up a stripped back version of the project here if helpful:

https://drive.google.com/file/d/1mkdyDyJTKaUZCo2JjM2UPARpf0aOP6Ab/view?usp=sharing

0
2 comments

Must be https://youtrack.jetbrains.com/issue/WEB-40965; please check if disabling js.debugger.use.node.options key in Registry (Help | Find action, type Registry to locate it) makes things any better.

BTW, the Vue app is run as a renderer process, you need using Attach to Node.js/Chrome run configuration to debug it

1. modify the electron:serve script as follows:

"electron:serve": "vue-cli-service electron:serve --remote-debugging-port=9223"

2. run the script

3. create the following debug configuration:

4. debug it (choose your app URL from the popup that appears to attach to it)

5. reload your app page to get breakpoints hit

 

1

Thanks you so much Elena - apologies I must have completely missed this reply all those months ago! I just tried this and it worked :) Note that it seemed to work whether or not I change the registry setting.

I have since upgraded to Webstorm 2019.2.4 and OSX 10.15.4 but can't verify if that affected anything.

0

Please sign in to leave a comment.