Search code examples
vercel

Environment variable for preview deploys with Vercel?


Does Vercel have an inbuilt environment variable for preview deploys (as opposed to production)?

I know that you can set these manually for different deployments, but I assumed this was a common enough requirement that there would be something available by default. However I can't find this in the documentation.


Solution

  • process.env.VERCEL_ENV will be "preview" for preview deploys.

    https://vercel.com/docs/projects/environment-variables