title: Electron "require is not defined"
body: <p>I'm making an application which I need to give access to the file system (fs) module, however even with <code>nodeIntegration</code> enabled the renderer gives me this error:</p>
  
  <pre><code>Uncaught ReferenceError: require is not defined
  </code></pre>
  
  <p>All similar problems I could find had a solution that said they needed to turn <code>nodeIntegration</code> on, however I already have it enabled.</p>
  
  <p>This is my main.js:</p>
  
  <pre><code>const electron = require('electron');   
  const {app, BrowserWindow} = electron;  
  
  let win;
  
  app.on('ready', () =&gt; {
      var { width, height } = electron.screen.getPrimaryDisplay().workAreaSize;
      width = 1600;
      height = 900;
      win = new BrowserWindow({'minHeight': 850, 'minWidth': 1600, width, height, webPreferences: {
          contextIsolation: true,
          webSecurity: true,
          nodeIntegration: true
      }});
      win.setMenu(null);
      win.loadFile('index.html');
      win.webContents.openDevTools()
  });
  
  </code></pre>
  
  <p>My index.js, linked in index.html as <code>&lt;script src="index.js"&gt;&lt;/script&gt;</code> currently only has <code>require("fs");</code> in it, I've commented out all the other stuff.</p>
  
  <p>I don't know why require still doesn't work even though <code>nodeIntegration</code> is enabled.</p>