title: How to export a require assigned to a variable?
body: <p>I'm doing the following to make this <code>require</code> to become visible in <code>&lt;app&gt;&lt;/app&gt;</code></p>
  
  <p><strong>index.html:</strong></p>
  
  <pre><code>&lt;script&gt;
    var electron = require('electron')
  &lt;/script&gt;
  &lt;app&gt;&lt;/app&gt;
  &lt;script src="bundle.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p><strong>App.vue:</strong></p>
  
  <pre><code>const ipc = electron.ipcRenderer
  console.log(ipc)
  </code></pre>
  
  <p>But I get <code>un-used</code> and <code>un-defined</code> var errors with ESLint, so I decided to do this:</p>
  
  <p><strong>requires.js:</strong></p>
  
  <pre><code>var electron = require('electron')
  
  exports.electron = electron
  </code></pre>
  
  <p><strong>index.html:</strong></p>
  
  <pre><code>  &lt;script src="requires.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;app&gt;&lt;/app&gt;
    &lt;script src="bundle.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>But now I get this error: <code>requires.js:3 Uncaught ReferenceError: exports is not defined</code>.</p>
  
  <p>What the correct way to export and import the electron <code>require</code>? </p>
  
  <p><strong>Note:</strong> requiring <code>electron</code> directly in <code>App.vue</code> doesn't work. You can only require <code>electron</code> in <code>index.html</code></p>
  
  <p><strong>Full example:</strong> <a href="https://github.com/alexcheninfo/vue-electron-simple" rel="nofollow">https://github.com/alexcheninfo/vue-electron-simple</a></p>