title: require() node module from Electron renderer process served over HTTP
body: <p>Typically, in an Electron app, you can <code>require</code> node modules from both the main process and the renderer process:</p>
  
  <pre><code>var myModule = require('my-module');
  </code></pre>
  
  <p>However, this doesn't seem to work if the page was loaded via HTTP instead of from the local filesystem.  In other words, if I open a window like this:</p>
  
  <pre><code>win.loadURL(`file://${__dirname}/index.html`);
  </code></pre>
  
  <p>I can <code>require</code> a node module without problems.  But if I instead open a window like this:</p>
  
  <pre><code>win.loadURL(`http://localhost:1234/index.html`);
  </code></pre>
  
  <p>I no longer can <code>require</code> node modules inside my web page - I get <code>Uncaught Error: Cannot find module 'my-module'</code> in the web page's console.  Is there any way to use node modules in an Electron page that was served over HTTP?</p>
  
  <hr />
  
  <p>A little context: My company is building an application that needs the ability to be hosted as a web application <em>and</em> inside an Electron shell.  To make this simpler and consistent across both environments, my Electron app starts a local web server and opens the app hosted at <code>http://localhost:1234</code>.  Now I'd like the ability to add spell checking/spelling suggestions into the application using <a href="https://www.npmjs.com/package/electron-spell-check-provider" rel="noreferrer"><code>electron-spell-check-provider</code></a>.  This module needs to be imported and initialized inside the renderer process, so I'm trying to <code>require('electron-spell-check-provider')</code> inside my web page, but this fails with the <code>Cannot find module</code> error.</p>