Is there any way in React to tell what environment I am in at runtime without exposing all my process.env
variables to the client?
Webpack allows me to expose environment variables to the client, which is dangerous.
if (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') {
// dev code
} else {
// production code
}
console.log('here come all my secrets: ', {process.env});
I am aware, this question has already been asked in context of Webpack, but I am trying to avoid a complex build configuration.
Is there any simpler solution?