I have a React app that is built using npm.
To build the app I can run...
npm run build
... and npm successfully bundles the javascript and assets into a ./build folder.
I can run...
npm start
...from the root of the app and npm will fire up a web server and I can run the app.
As an aside, the app is deployed as as a browser extension at the moment but I don't think this is relevant.
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.
I have found the running..
npm pack
in the root folder produces a tgz file. I can then call npm install <path_to_root>\the-tgz-file.tgz
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.
Surely I'm missing something really simple! Help!