There is some peculiar scenario when starting my react app with react-script start
on two instances.
For one instance I see the error boundary overlay screen while for other instance I don't see the error boundary screen whenever there occurs any runtime exception, though both instance have the same code base and started with react-scripts start
. I am starting both instances with react-scripts start
, because I want both of them to run development mode.
I set NODE_ENV=development and verified in app.js that process.env.NODE_ENV
is begin set as development
. Still I don't see the error overlay screen for one of the instance when runtime exception. This error is clearly logged in the console. But for one instance I get the error overlay screen while not for the other instance.
As per Tyro
below in his answer, it seems that checking NODE_ENV
will tell if the app is running in prod or dev mode. But, in my case though NODE_ENV
is checked to be set as development
, but the behavior is like production
mode since, error overlay is not appearing with runtime exception, though gets logged to console.
Question:
1) Checking for NODE_ENV tells about the variable value but how we can know if the app is really running in the environment dictated by NODE_ENV ?
2) In my case, the app is behaving as in production mode even though the value of NODE_ENV checked is 'development' since the error boundary overlay screen is not appearing though error gets logged to console. Is there any other scenario when the error boundar overlay screen won't appear even though in development
mode ?