我们有一个使用CRA 1.x创建的简单React应用程序。
We installed dotenv to use environment variables on the project and our variables are included on the .env and .env.development files like this:
.env
REACT_APP_LOGGER=LOGGER
Run Code Online (Sandbox Code Playgroud)
.env.development
REACT_APP_LOGGER=NO_LOGGER
Run Code Online (Sandbox Code Playgroud)
Then in the code we have this logic:
if(process.env.REACT_APP_LOGGER === "LOGGER") {
// do something
}
Run Code Online (Sandbox Code Playgroud)
On local builds with webpack 4 in development mode the if is true, and on production mode is false.
But on azure, in both cases is false
process.env.REACT_APP_LOGGER === "LOGGER" // false
Run Code Online (Sandbox Code Playgroud)
We have checked …