Previously on...
In the previous sections and stories, I explained how to integrate an Angular-CLI generated application with Electron, ...
For further actions, you may consider blocking this person and/or reporting abuse
I know others have said it before but you are my hero. After trying just about everything else the internet had to offer I finally got where I wanted because of this post.
I specially registered to thank you, without this I would spend many hours researching how to do that. 2023 and it still works! Now I can focus on what I wanted to do.
To everyone having issues with "Electron's IPC was not loaded":
You need to add
contextIsolation: false
towebPreferences
.Example:
It worked for me.
Thanks
Michael, thanks so much for the reply.
Great tutorial by the way!
I am using VSCode and I type in:
In the VSCode terminal window
Then the Chromium window opens successfully, which is good.
At this point, I get:
In Chromium’s DEV tools console
Then I type:
In Chromium’s DEV tools console and press return.
This is when I receive the error.
This simply does not work.
ENVIRONMENT
I have copied everything precisely and after the window opens successfully, I type in:
Into Chromium's Dev Tool input.
I get the following error:
I also get a warning in the console:
You have to run npm run electron:start in the Angular app, and npm start in the electron app.
That being said, I have to update this as this may be outdated.
Seems I'm not the only one keep getting 'IPC was not loaded', which means window.require is still not allowed? Tried almost every solution on the web, yours is the closest one to my own, but unfortunately, both mine and yours don't work, the only difference is mine is based on a pretty old version of electron and angular, I just updated them to the latest version, but the entry point remains main.js instead of index.ts, well, no idea what's going wrong
I'm stuck with the exact same issue in another angular app using electrum. I think the code was taken from this guide because it's pretty much identical but was broken when upgrading electrum and angular. The window object is undefined and I've tried adding the nodeIntegration: true in webPreferences but no difference.
It doesn't get passed this step (which worked perfectly fine before): github.com/BitDesert/Nault/blob/c3...
Still no solution to this?
Missing from this article is that, for
window.require
to work you also need to make sure your BrowserWindow you create has the optionThanks! Looks like one of the changes they introduced with Electron 4. electronjs.org/blog/electron-4-0
Yes. I have added:
But, I still cannot get the IPC communication working.
What's IpcCallback? Googling for it...
you can simply replace that with
any
to get things going :)Hi Michael. The part I am a little unsure about is the:
Do I add this to the Chromium DevTools console?
If I try and add:
To the VSCode terminal window, after I have run:
It tries to convert it to:
This npm start should start the electron app.
I think I am going to try and use ngx-electron, and see if that helps. I just cannot get this to work...
Sorry I couldn't reply to you earlier. Sure, try that. Did you follow the series since the first part? In the first post, the two package structure is introduced, and it seems like you are using just Angular for this.
You could read the comments in the post as well because some of them are about updates in Electron, you must activate some things that in previous versions were activated by default.
I'll reply as soon as possible. Happy hacking!
Michael, could you upload the source code for this app to GitHub. I might be able to work out, where I have gone wrong, if I can compare my code to yours.
by the way if you want a really good starter template that is maintained have a look at github.com/maximegris/angular-elec... its what i use, some modules tho (like electron-settings, etc) still need the window.require thing, its just how it is if your using webpack (angular, vue, and react all do)
I notice that in recent versions of the CLI that file is not longer created. You can create it however.
My project Angular don't have file /src/typings.d.ts ,what should i do? Thanks
Where does the IpcCallback come from