Is It Possible to Use the Elm's Debugger in an Electron App During Development?

I’m using Elm 0.19.1 to build the interface of a desktop app, which in turn is based on Electron.

However, in debug mode of Elm, I can’t open the debugger. This is what shows up in the console of the app’s window: Uncaught TypeError: Cannot set property 'title' of undefined .

It’s triggered by this piece of Elm’s generated JavaScript code:

var doc = debuggerWindow.document;
doc.title = 'Elm Debugger';

Apparently, the debugger window object doesn’t have a document property inside it, possibly due to the fact that each window in an Electron app runs on its own process. Is there any way to fix this and get Elm’s debugger up and running during the development of my app?

1 Like

Hey @nahiyan,

AFAIR you’ll have to set webPreferences.nativeWindowOpen to true when you’re creating your BrowserWindow in the main process. See BrowserWindow | Electron

5 Likes

I can’t thank you enough, @bruchmann. I believe this solution is going to be helpful for a lot of people out there. I’m going to answer this question on Stack Overflow now, giving you full credits. Have a good day!

Glad I could help you out. Let me know if you need more help working with elm and electron.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.