Development vs Production environment


#1

So i have 2 urls

const DEVELOPMENT_BASE_API = "http://localhost:8000/api";
const PRODUCTION_BASE_API = "http://mydomain.com/api";

How do i make it so that development domain is always used during development and when building e.g exp build:android

Something like

if (isBuildingStandaloneApp) {
    base_api = PRODUCTION_BASE_API;
} else {
    base_api = DEVELOPMENT_BASE_API;
}

#2

@delgiudices No, you can’t. For now, just change it manually when you deploy.

or you can create your own bash script if your config is grouped in one file, which running this:

  • cp environment.json.dev.dist environment.json
  • exp build:android

#3

You could use __DEV__.


#4

@delgiudices DEV is true when run locally, but false when published


#5

Is there any solution to this yet? I tried to figure a way around it (messed around with the Host & Protocol) but couldn’t get it. If not, is there a solution for this long-term?