I am working on a Single Page Application (SPA) using React and built with Webpack as part of create-react-app. In my application, I display the version number fetched from package.json like this:
import npmInfo from 'package.json'
...
<div className="version">{npmInfo.version}</div>
However, including the whole package.json file in the built javascript exposes more information than necessary to the public.
Is there a way to only extract the version number from package.json without resorting to setting it as an environment variable or accessing it through process.env.VERSION?