I have an Expo app where the web component is hosted through Vercel. I use the Vercel GitHub integration for automatic deployment. Expo has a different build command for staging builds and production builds, and it doesn't appear Vercel supports environment/staging based build commands. I'm wondering if I'm possibly missing something and this is possible or anyone has another way of handling this?
I was in a similar situation and managed to solve it with a shell script.
Here is an example you can try out:
#!/bin/bash
if [[ $VERCEL_ENV == "production" ]] ;
then
echo "Building production"
yarn build:production
else
echo "Building staging"
yarn build:staging
fi
And lets say you called the file vercel.sh
, you would configure vercel buildCommand to be sh vercel.sh
.
Basically, from the shell script you'll be able to use any of the system environment variables vercel provides.