title: Electron fails to find react module on its installed dependencies
body: <p>My app works fine in <code>npm run dev</code> &amp;/or <code>yarn run build</code> &amp;&amp; <code>yarn start</code></p>
  
  <p>But packaged version fails to find dependencies <em>of</em> dependencies, specifically 'react' within react-player or react-countup. </p>
  
  <pre><code>Uncaught Error: Cannot find module 'react' Require stack:
  
  /Applications/ElectronReact.app/Contents/Resources/app.asar/node_modules/react-countup/build/index.js
  
  /Applications/ElectronReact.app/Contents/Resources/app.asar/app.html at Module._resolveFilename (internal/modules/cjs/loader.js:717) at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (reset-search-paths.ts:40) at Module._load (internal/modules/cjs/loader.js:622) at Module._load (electron/js2c/asar.js:717) at Function.Module._load (electron/js2c/asar.js:717) at Module.require (internal/modules/cjs/loader.js:775) at require (internal/modules/cjs/helpers.js:68) at Object. (/Applications/ElectronReact.app/Contents/Resources/app.asar/node_modules/react-countup/build/index.js:8) at Object. (/Applications/ElectronReact.app/Contents/Resources/app.asar/node_modules/react-countup/build/index.js:600) at Module._compile (internal/modules/cjs/loader.js:880)
  
  internal/modules/cjs/loader.js:720
  </code></pre>
  
  <p>It's a React, Firebase, Redux, REST API app.</p>
  
  <p>I checked it packaged and opened properly first before doing much with the boilerplate. Just stripped back some counter logic and put in some basic styling etc.</p>
  
  <p>I have installed (firebase, react-player, react-countup) dependencies at <code>app/package.json</code> level not <code>root/pkg json</code></p>
  
  <p>Unsure how/why app's ability to find React would've changed by anything i've done. I dont think i've touched any config for a while. And even then it was the <code>main.dev.js</code> not <code>main.prod.js</code> - which looks like it's gone through a transpiler and i wouldn't know how to edit anyway.</p>
  
  <p><a href="https://i.stack.imgur.com/d96P7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d96P7.png" alt="electron app web dependency error"></a></p>
  
  <p>The nuts and bolts of this:
  Error suggests it's failing to find 'react' via the common JS loader, loading modular js into browser. That's when it's loading the react-countup package. If i remove that npm pkg and then re-package my app, it fails with same error on the next dependency i installed (react-player). If i kill that, it moves onto <code>Prismic-ReactJS</code> pkg.</p>
  
  <p>Have i installed packages at the wrong level? (app/package.json)
  Do i need to link dependencies OF dependencies somehow?
  Is there a main.js setting somewhere that I've tweaked by accident?</p>
  
  <p>Can anyone help?</p>