debbuging two electron projects simultaneously

I develop an electron based Client-Server application and need to debug them simultaneously. Both are in different projects and for debbuging I use a node.js configuration and the local electron.exe.

D:\[path-to-application]\node_modules\electron\dist\electron.exe

But when launching them, both the applications seem to share one chromium and therefore all the local storage values and indexedDB's. Is there a way to debug them in separate instances?

16 comments
Comment actions Permalink

Not sure I understand your setup... Is it about debugging render process with Chromium Remote?

0
Comment actions Permalink

No. It's just about running two separate Electron apps from Webstorm at the same time.

I have a Server App and a Client App. Both in different Folders and different Projects, but on the same Machine.For both of them there is a Run/Debug Configuration with

D:\[path-to-server-app]\node_modules\electron\dist\electron.exe resp. D:\[path-to-client-app]\node_modules\electron\dist\electron.exe and the respective app directory as Working directory.

When I start them at the same time (which is necessary in development), from two different instances of Webstorm they seem to share one chromium instance because both apps share only one local.storage. When I start the app outside webstorm with 'npm start' in CLI it works as expected.

0
Comment actions Permalink

do you start both with a single npm script, or run 2 scripts simultaneously? what do your scripts look like?

0
Comment actions Permalink

They have their own script, but those look pretty much the same.

"main": "main.js",
  "scripts": {
    "start": "electron ."
  },

0
Comment actions Permalink

Thanks. That was a good idea.

There is in fact only one directory in my AppData/Roaming/ folder called 'Electron' when I start from Webstorm (where of course the local.storage gets mixed up). When I start from CLI everything is in AppData/Roaming/[name_of_application] Folder which works just fine. Any idea why Webstorm sets the directory to 'Electron'? The word does not even appear in my package.json. At least not written with an capital "E"...

0
Comment actions Permalink

Looks related to https://discuss.atom.io/t/app-getpath-userdata-seems-to-give-the-wrong-path/26006 - it appears that the name from package.json is not used when passing .js file to electron, but works with `electron .`

0
Comment actions Permalink

But I'm not passing the main.js. My package.json only has "start": "electron ." which - according to this post - should work. Also this strange behaviour only happens when running from Webstorm. As long as I use CLI it does use the correct AppName Folder.

In Webstorm I did set main.js in "JavaScript File" in the Run/Debug Configuration. But if I delete it from there it does not work.

0
Comment actions Permalink

>But I'm not passing the main.js

you are passing it in your Node.js run configuration - when using it, you are running `electron main.js`

>But if I delete it from there it does not work.

what doesn't work namely?

0
Comment actions Permalink

If I delete main.js from my Run/Debug Configuration Webstorm just starts electron, not my app

0
Comment actions Permalink

Did you specify `.` as application parameter, to let Electron know what to start?

0
Comment actions Permalink

Yes. My startup script is

"scripts": {
    "start": "electron ."
  },

I'm quite sure it has something to do with the way Webstorm is handling the start process. Somehow there seems to be a difference to the native start process.

 

0
Comment actions Permalink

>Yes. My startup script is

But you are NOT using your startup script, you are using Node.js run configuration. So you need to specify application parameters there, and not in your npm script...

Sorry if it doesn't look obvious, but, honestly, I'm nonplussed by some of your replies...

1
Comment actions Permalink

The "." Parameter was the point I was missing! It's not mentioned in the blogpost I used as reference for setup, and I did not realize that I do not use my own startscript when running via Webstorm. 

Thank you. Problem solved.

1
Comment actions Permalink

great, thanks for update!

0

Please sign in to leave a comment.