Workflow: Managed
eas-cli
version and node version: eas-cli/3.8.1 darwin-arm64 node-v18.12.1
I am trying to use process.env variable to dynamically build to different env, but I am running into an issue where the process.env in the app.config.json is losing it’s value. I just recently upgraded from sdk 45 to sdk 47. I consoled log in the app.config.json and I get the right value 2 and the undefined.
Here is the relevant code:
app.config.json
{
...config, \\ this is my config from my app.json file
extra: {
REACT_APP_STAGE: process.env.REACT_APP_STAGE,
},
runtimeVersion: {
policy: 'sdkVersion'
}
};
eas build
{
"cli": {
"version": ">= 2.8.0"
},
"build": {
// branch name
"development": {
"extends": "production",
"developmentClient": true,
"distribution": "internal",
"channel": "development", // update your doing to the branch
"autoIncrement": false,
"env": {
"REACT_APP_STAGE": "development"
}
},
// branch name
"staging": {
"extends": "production",
"autoIncrement": false,
"channel": "staging", // update your doing to the branch
"env": {
"REACT_APP_STAGE": "staging"
}
},
// branch name
"production": {
"distribution": "store",
"channel": "production", // update your doing to the branch
"autoIncrement": true, // will auto increment the buildNumber for ios and the versionCode for google
"env": {
"REACT_APP_STAGE": "production"
},
"ios": { "resourceClass": "m-medium" }
}
}
}
The config file that looks for what profile to set
return useProduction
? Config.getProdConfig()
: useStaging
? Config.getStageConfig()
: Config.getLocalConfig();
useProduction and useStaging
export const useProduction =
Constants?.expoConfig?.extra?.REACT_APP_STAGE === 'production' ||
Updates.channel === 'production';
export const useStaging =
Constants?.expoConfig?.extra?.REACT_APP_STAGE === 'staging' ||
Updates.channel === 'staging';
When console logging during build I get this
Any help would be appreciated.