Electron IPC and nodeIntegration : <p>So, I've followed a number of guides to set up Webpack, Electron, and React to make a desktop application. After finishing the setup, I got to work, and learned that I needed to require an IPC mechanism from the main and renderer in order to communicate.</p>

<p><code>import {ipcRenderer} from "electron";</code>
Adding this to my renderer.js file causes the error <code>Uncaught ReferenceError: require is not defined</code>.</p>

<p>After taking my problem to some colleagues, it was suggested that in my main.js file I should change</p>

<pre><code>webPreferences: {
    nodeIntegration: false,
}
</code></pre>

<p>to</p>

<pre><code>webPreferences: {
    nodeIntegration: true,
}
</code></pre>

<p>Everywhere I've read on google has said very clearly that if safety is something you care about, this is <em>not</em> something you should do. However, every resource I've been able to come across for electron ipc has used the ipcRenderer.</p>

<p>Now, does every example on the internet have huge security flaws, or am I missing some key part here?</p>

<p>My questions are as follows.</p>

<ol>
<li>Is it possible to use ipcRenderer without enabling nodeIntegration?</li>
<li>If it is, how do I do it, and why would so many resources exclude this information?</li>
<li>If it is not, what do I use?</li>
</ol>

<p>If I'm asking the wrong question, or I missed something, or there are any other clear problems with the way I've asked this question please let me know, otherwise thanks in advance.</p>
