electron-userland / electron-webpack

Scripts and configurations to compile Electron applications using webpack
https://webpack.electron.build/
905 stars 171 forks source link

debug with webstorm / phpstorm #403

Open thib3113 opened 4 years ago

thib3113 commented 4 years ago

Hello,

I try your quickstart, and try to start the project ...

But :

It seems my phpstorm already use the port 5858, so I modify dev-runner.js to change to a random port ( like 7233 ), and it's start .


I also follow this tutorial https://blog.jetbrains.com/webstorm/2016/05/getting-started-with-electron-in-webstorm/ , replacing the electron executable by the electron-webpack executable, and adding dev . in the Node parameters

image

So when starting this configuration, it will produce a command like :

~\repos\decky\electron-webpack-quick-start\node_modules\.bin\electron-webpack.cmd --debug-brk=14033 --expose_debug_as=v8debug dev .

So my questions are, did I miss something to debug it ? ( I wan't to add breakpoints for "main" process in phpstorm, and use devtools for the "renderer", can I ? else how to debug the main ? ) .

How to configure my phpstorm ? or do I need to update the dev runner, to take the arguments from the argv and add them to the args passed to electron ?

Regards

justin-hackin commented 4 years ago

You can change the port that electron runs on with this tip https://github.com/electron-userland/electron-webpack/issues/76#issuecomment-392201080

electron-webpack is not a node interpreter (in this case electron is). Debugging the running of electron-webpack dev as an npm script will only let you debug inside of your webpack configuration scripts though.

I'm not sure how to debug the main process in intellij, tricky because electron-webpack dev runs webpack scripts using nodejs as interpreter but then it spawns electron. As a last resort, if you need to debug the main process outside intellij, the process should show up in the chrome://inspect/ window.