Closed Abdul-Asa closed 8 months ago
same problem here
This is the same issue as #413.
Unfortunately, the base template has recently been updated to follow long since established best practices of not allowing the renderer to access "privileged" modules (electron
being one of them), but the examples haven't all caught up.
The very short term and not recommended fix is to swap the values of nodeIntegration
and contextIsolation
in ./main/helpers/create-window.ts
. That is, you want them to look like this:
const win = new BrowserWindow({
...state,
...options,
webPreferences: {
...options.webPreferences,
nodeIntegration: true,
contextIsolation: false,
},
})
However, you shouldn't do this. As I recommended in #413, have a read of the official Electron IPC documentation, and follow those practices instead. It's not a great deal of work: you just need to expose a limited API to the renderer process via a preload script: https://www.electronjs.org/docs/latest/tutorial/ipc
Hopefully the examples will be updated in time (I would update the IPC one myself if I could find the time!)
I'll fix the bug soon, sorry for inconvenience 🙇
@Abdul-Asa CC: @Mrx-dev @makeusabrew
Nextron v8.12.0 is out! Now it supports preload script for secure IPC features :)
If you have time, please try new examples:
npx create-nextron-app test-app --example basic-lang-typescript
It's all good and working now Thank you @saltyshiomix and thanks for the advice @makeusabrew
@Abdul-Asa CC: @Mrx-dev @makeusabrew
Nextron v8.12.0 is out! Now it supports preload script for secure IPC features :)
If you have time, please try new examples:
npx create-nextron-app test-app --example basic-lang-typescript
great, just use window.ipc.send()
~ thank you!
Hi, I'm trying to create a nextron app with ipc communications but I keep getting an error anytime I import anything from the electron module. I've read similar issues on the github repo and even used the ipc example template but that doesn't work and no explicit fix on the issue. I figured this fix will be on the road map but it wasn't stated there either. How can I solve this? Any advice would be helpful. Thanks.