title: Webpack Externals require not defined with Electron and Angular 4
body: <p>I have a setup with <strong>Webpack</strong>,<strong>Electron</strong>, and <strong>Angular 4</strong>. I searched and tried several approaches, however as I could not solve it, i am going to ask here.</p>
  
  <p>When i run webpack, it compiles without errors, however in the browser's console i get</p>
  
  <pre><code>Uncaught ReferenceError: require is not defined
      at Object.128 (external "require('fs')":1)
  </code></pre>
  
  <p>I tried to include it in several ways:</p>
  
  <pre><code>let fs = require("fs");
  </code></pre>
  
  <p>I had the same issue with path, child_process, etc.</p>
  
  <p>My <strong>webpack.config.js</strong> defines externals:</p>
  
  <pre><code>module.exports = {
      "externals": {
          "electron": "require('electron')",
          "child_process": "require('child_process')",
          "fs": "require('fs')",
          "path": "require('path')",...
      }
  }
  </code></pre>