title: Electron App node-integration : How to access require() after POST
body: <p>I'm building an electron app and have run into a problem with require being undefined when a page POSTs to itself. My goal is to use electron as a wrapper around an existing site that, unfortunately has this post behavior. After lots of trial and error with preload and executeJavascript I found using require() and node-integration worked. That is unless the request is POST. I am pretty new to Electron and node, so maybe I'm just missing something simple!</p>
  
  <p>I get this behavior in Electron 0.26.0 and 0.27.1.</p>
  
  <p>Here is the simplest way to recreate the issue.</p>
  
  <p><em>package.json</em></p>
  
  <pre><code>{
  "name": "PostExample",
  "version": "0.1.0",
  "main": "main.js",
  "description": "Post Loses Global"
  }
  </code></pre>
  
  <p><em>main.js</em></p>
  
  <pre><code>var app = require('app')
  var BrowserWindow = require('browser-window')
  
  var mainWindow = null;
  
  app.on('window-all-closed', function() {
      app.quit()
  });
  
  app.on('ready', function() {
  
      mainWindow = new BrowserWindow({ 
          "node-integration": true,
      });
  
      mainWindow.loadUrl('file://' + __dirname + '/index.html')
  
      mainWindow.openDevTools()
  
  });
  </code></pre>
  
  <p><em>index.html</em></p>
  
  <pre><code>&lt;html&gt;
   &lt;script type="text/javascript"&gt;
      console.log(typeof global)
      try{
          var fs = require("fs");
      } catch(e){
          console.warn("ERROR", e)
      }
   &lt;/script&gt;
  &lt;body&gt;
   &lt;h1&gt;Posts to self&lt;/h1&gt;
   &lt;form action="" method="post"&gt;
      &lt;input type="text" name="somevar" value="val" /&gt;
      &lt;button type="submit"&gt;Go&lt;/button&gt;
   &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>