I’ve tried to import ipcRenderer in react app
import {ipcRenderer} from 'electron';
but I get this error message : require is not defined
Advertisement
Answer
You need to use
const { ipcRenderer } = window.require("electron");
Otherwise it will try to import it from Webpack or whatever module bundler you use.
You can checkout this thread for a better explanation: