How to use expo prebuild on specific environment

I’m trying to get the way expo prebuild work. When running expo prebuild it will use app.json and app.config.js to generate stuff. But if I run expo prebuild it doesn’t know which environment I’m doing. I see there’s a param --config which seems fine but it’s said deprecated. I’m wondering if there’s a way to check environment at app.config.js so I can do ‘if else’ on that :slight_smile:

One more thing, I see on EAS build, they execute expo prebuild. Does it fetch app.config.js at this time or just the generated config at previous step?

Hi @chungxa

Yes, you can use environment variables instead of --config. See the following:

Ah, got it.
For EAS build, they set the environment variable global, right? It means all later commands will have the environment variable included to process.argv?

For EAS Build (except if you’re running eas build --local), yes, if you set the environment variable in eas.json then they will be globally set in the build worker while your app is being built.

1 Like