my code:
const { ipcRenderer } = window.require('electron');
Error:
TypeError: window.require is not a function
I tried to use IPC communication to control the Electron window via React.
However, the error 'TypeError: window.require is not function' continues.
Setting 'node integration' to true also results in an error.
Is there a sure way to fix this error?
Also, is there a way to control the Electron window with React without using IPC communication?
Renderer process or not, require()
is a NodeJS function to import external modules into your file, it is not something that will be on the window
object.
const { ipcRenderer } = require('electron');
Keep in mind that your current configuration is completely insecure, and you should really consider using IPC with a preload file.