I have an SPA application (in React) built with Webpack (as part of create-react-app) where I display a version number retrieved from the package.json likes this:
import npmInfo from 'package.json' ... <div className="version">{npmInfo.version}</div> However this results in also other package.json being part of built javascript file and exposed to the public.
Is there an approach to retrieve just the version from package.json other than reading it in parent the process and setting it to environment variable (and reading it via process.env.VERSION) ?
package.json