I am used to being able to configure my builds in CI via environment variables. E.g., if I have npm run build I would like to be able to use that same command, but have it behave differently based on the environment. Currently I can somewhat affect my build via NODE_ENV=production for a production build and NODE_ENV=development for a staging build. I would like to have the same control for the mode.
Suggested solution
Similarly to NODE_ENV we could have the VITE_MODE or MODE environment variable change the mode.
Alternative
In order to change import.meta.env.MODE, I need a separate command npm run build:staging, or I need to adjust the command I run like npm run build -- --mode staging. These workarounds make my CI config more complex than it could be.
Description
I am used to being able to configure my builds in CI via environment variables. E.g., if I have
npm run build
I would like to be able to use that same command, but have it behave differently based on the environment. Currently I can somewhat affect my build viaNODE_ENV=production
for a production build andNODE_ENV=development
for a staging build. I would like to have the same control for the mode.Suggested solution
Similarly to
NODE_ENV
we could have theVITE_MODE
orMODE
environment variable change the mode.Alternative
In order to change
import.meta.env.MODE
, I need a separate commandnpm run build:staging
, or I need to adjust the command I run likenpm run build -- --mode staging
. These workarounds make my CI config more complex than it could be.Additional context
No response
Validations