Description
I have application settings that depends on the environment. You know, the classic config file that exports things in this way:
if (process.env.NODE_ENV === 'production') {
// export production key/values here
} else {
}
I'm trying to test my production configuration locally by running
NODE_ENV=production npm start
, however the NODE_ENV
is always overwritten to development
.
I ejected the code and realized that this is explicitly done at start.js
script and webpack.DefinePlugin
configuration, so I'm sure there were good reasons to do that. But, don't you guys think this is a very common pattern and something that probably other developers will try too?
I know #342 added support for custom variables and I could do something like REACT_APP_ENV=production npm start
and change my code to rely on this variable instead, which is great, but I'm wondering if it wouldn't make this a little tricky, specially for people getting started with React.