Here is the code:
if (process.env.NODE_ENV === 'production') {
module.exports = require('./keys_prod');
} else {
module.exports = require('./keys_dev');
}
keys_prod IS on the server
keys_dev is only on my local machine
Here is the problem:
when the app starts up on Heroku I get the following:
ERROR in ./src/environment/keys.js 8:2-40
Module not found: Error: Can't resolve './keys_dev' in '/app/src/environment'
Heroku Config vars
I seem to remember reading somewhere, a long time ago that environment variables in Heroku for a React app needed to be prefixed with REACT_APP in order for the React app to pick them up... but that doesn't seem to be the case now.
I have the following set in the Heroku config vars:
package.json
my package.json scripts section
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build"
},
saw this but I am on heroku 22 - so that won't work
Try 1
It was suggested to set NODE_ENV to production...
Try 1 - Result
ERROR in ./src/environment/keys.js 8:2-40
Module not found: Error: Can't resolve './keys_dev' in '/app/src/environment'


You're setting
REACT_APP_NODE_ENV, but notNODE_ENV. SetNODE_ENVto production.