Closed pixkk closed 8 months ago
Look into exposing a minimal subset of the electron API to your renderer process via a context bridge and invoking an IPC send from methods you expose via that bridge. This section of the official Electron docs covers the pattern you're after: https://www.electronjs.org/docs/latest/tutorial/ipc#pattern-2-renderer-to-main-two-way
Look into exposing a minimal subset of the electron API to your renderer process via a context bridge and invoking an IPC send from methods you expose via that bridge. This section of the official Electron docs covers the pattern you're after: https://www.electronjs.org/docs/latest/tutorial/ipc#pattern-2-renderer-to-main-two-way
Thanks for the answer. It seems like I solved the problem a long time ago, so I’ll write an answer for those who came here.
Play with the renderer settings (examples/........./renderer/next.config.js, config.target option). If you have a problem using IPC, look at the settings from the project template where IPC is used.
what should I change in (renderer/next.config.js) ?
Edit: I look through (examples/ipc-communication/renderer/next.config.js) settings its the same settings that i have in renderer folder and i still go the same error any idea how to fix it?
Error:
Module not found: Can't resolve 'fs'
For example, i want use next code (client side render):
Any mention of "require('electron')" in the page code generates the error "./node_modules/electron/index.js:1:0 Module not found: Can't resolve 'fs'" (module FS installed and used in another file successfully)
Is it possible quit app by JavaScript?
PS.: it can bypassed by window.close(), but is it best method of closing app?