.env values are returning the string that should have been referencing a value within package.json, but instead are displaying the literal text from the env file.
in my .env file I have tried the following:
REACT_APP_VERSION=`${npm_package_version}`
REACT_APP_NAME=`${npm_package_name}`
REACT_APP_VERSION=$npm_package_version
REACT_APP_NAME=$npm_package_name
I am using the following script to associate the .env file
"start": "env-cmd -f .env.production react-scripts start",
These are being returned as the literal strings from the .env file,
My app is returning these values literally.
<p>App Name: {process.env.REACT_APP_NAME}</p>
<p>App Version: {process.env.REACT_APP_VERSION}</p>
Thus, these become:
App Name: `${npm_package_name}`
App Version: `${npm_package_version}`
Any thoughts on what I am doing wrong here?
These ideally should have been returning the name of the app, and its semantic version number.
Brandon Westerman is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.