title: How to convert a react app to an npm module?
body: <p>I have a React app that is built using npm. </p>
  
  <p>To build the app I can run... </p>
  
  <pre><code>npm run build
  </code></pre>
  
  <p>... and npm successfully bundles the javascript and assets into a ./build folder.</p>
  
  <p>I can run...</p>
  
  <pre><code>npm start
  </code></pre>
  
  <p>...from the root of the app and npm will fire up a web server and I can run the app.</p>
  
  <p>As an aside, the app is deployed as as a browser extension at the moment but I don't think this is relevant.</p>
  
  <p>I want to be able to package the react app as an npm module and include it in another application (so that the same code is run in our browser extension and our native web application). This seems like an extremely simple idea but in practise I'm struggling to make it work.</p>
  
  <p>I have found the running..</p>
  
  <pre><code>npm pack
  </code></pre>
  
  <p>in the root folder produces a tgz file. I can then call <code>npm install &lt;path_to_root&gt;\the-tgz-file.tgz</code> and that seems to successfully install the module in our native web app. This handles the node dependencies but it installs the full root directory of our React App. I only want to package the bundled, minified contents of our build directory (not the raw source files) but I do want npm to handle dependencies for me.</p>
  
  <p>Surely I'm missing something really simple! Help!</p>