process.env.NODE_ENV is flaky

#1

i’m using process.env.NODE_ENV is my code to determine config settings.

i.e. if process.env.NODE_ENV == 'production' then it should use a certain set of configs.

In the standalone app on android this looks kind of flaky (not sure about ios yet). By flaky i mean that the app will start and report it is in dev mode.
If i dismiss the app and start it again it will switch to production.

is there a known issue around this? Is there a better recommended way for me to tell if the app is in production mode?

#2

Hi @wexpo! We recommend using the __DEV__ global instead of process.env.NODE_ENV.

#3

ok so __DEV__ will be true if it is development mode?

How to set and access environment variables?
#4

Yes that is correct!

closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.