Environments in Create React App

I was able to get it working using cross-env. I had to install the package and use the syntax below:

“start”: “cross-env REACT_APP_STAGE=dev react-scripts start”,
“build”: “react-scripts build”,
“test”: “react-scripts test --env=jsdom”,
“predeploy”: “cross-env REACT_APP_STAGE=dev npm run build”,

Thanks!

-Derek

1 Like