Closed MikeSniegovski closed 4 years ago
You have misunderstood what the node env (NODE_ENV) is used for. The NODE_ENV variable defines the type of build to be done, NOT where the build is to be deployed. (i.e. How, not Where).
There are 3 valid env's:
If env wasn't supplied, it's assumed to be 'development'.
There can be multiple 'production' environments for where the site is deployed/hosted. You do not change the node env value for them - you build them with separate environment settings in the .env file.
i.e. if you have a 'staging' and a 'production' deployment, you'd build both sites with 'env' set to production (so that you get the fully pre-built website), but would have different environment variables in your .env
files when building the two sites. You can have a separate custom .env file for different sites - e.g. .env.staging
, .env.qa
, etc.
See CRA's documentation on environment variables and on building for multiple environments with custom .env files.
Yep. I attempt to build staging env without env-cmd
installed. I assumed that react-app-rewired can do it by itself. My bead.
I have to build my app for enviroment diffrent then production. After looking into react-app-rewired/scripts/build.js i see that there is no such option.