title: NodeJS modules not supported in Electron Web Workers
body: <p>I am constructing a desktop application using Electron in tandem with ReactJS. </p>
  
  <p>I open a new, invisible BrowserWindow from the first renderer process to launch another renderer process. In this new renderer process, I register a web worker where an API call will be periodically called to fetch data. </p>
  
  <p>This is the code in the invisible window HTML script tag to register the web worker:</p>
  
  <pre><code>let installWebWorker = () =&gt; {
       console.log("installWebWorker()");
       if (typeof(Worker) !== "undefined") {
           console.log("Web worker supported");
           let monitorsWorker = new Worker("fetchMonitors.js");
       } else {
           console.log("Sorry! No Web Worker support...");
       }   
   }; //end installWebWorker()
   installWebWorker();
  </code></pre>
  
  <p>In the fetchMonitors.js worker itself, I require the "electron-is-dev" node module to make the fetch API call in development. To do so, I use require("electron").remote.require("electron"). I obtain the following error:</p>
  
  <p>DevTools Error:
  <img src="https://i.stack.imgur.com/JcuPC.png" alt="DevTools Error"></p>
  
  <p>This error leads me to believe that Electron NodeJS modules are not supported in web workers. The Electron documentation <a href="https://github.com/electron/electron/blob/master/docs/tutorial/multithreading.md" rel="nofollow noreferrer">here</a> says otherwise, however.</p>