Fix Expo Build Env Variables
Budget: $10 – $30 USD
I’m stuck wiring environment variables into my React Native app at build time. The app runs under Expo and I use EAS Build, but the values I set for the development, Preview, Production profile never make it into the JavaScript bundle.
expo's version is the latest.
The document of EXPO
https://docs.expo.dev/eas/environment-variables/
I am modifying eas.json, app.config.js accordingly, though. whatever I set like
expo:{
extra: {
EXPO_PUBLIC_BUILD: process.env.EXPO_PUBLIC_BUILD,
}
}
and then,
eas build --platform android --profile development --clear-cache
but I dont see the variable EXPO_PUBLIC_BUILD by doing
console.log("expoConfig", Constants.expoConfig?.extra);
or console.log(process.env.EXPO_PUBLIC_BUILD); in tsx files, It always undefined.
the document seems not complicated but I cant make it anyways.
so I would like you to create a simple example to produce this environment variable correctly.
expo's version is the latest.
The document of EXPO
https://docs.expo.dev/eas/environment-variables/
I am modifying eas.json, app.config.js accordingly, though. whatever I set like
expo:{
extra: {
EXPO_PUBLIC_BUILD: process.env.EXPO_PUBLIC_BUILD,
}
}
and then,
eas build --platform android --profile development --clear-cache
but I dont see the variable EXPO_PUBLIC_BUILD by doing
console.log("expoConfig", Constants.expoConfig?.extra);
or console.log(process.env.EXPO_PUBLIC_BUILD); in tsx files, It always undefined.
the document seems not complicated but I cant make it anyways.
so I would like you to create a simple example to produce this environment variable correctly.
Related categories:
JavaScript
Mobile App Development
Android
Unity 3D
Node.js
React Native
Android App Development
Expo