Environment variables
Dotenv loading order, exposed defines, and CLI environment variables.
#Dotenv order
#Addonova loads these files from the project root, with later files overriding earlier ones:
.env.env.local.env.<mode>.env.<mode>.local.env.<browser>.env.<browser>.local
<mode> is development or production. <browser> is chrome, chromium,
edge, or firefox.
Exposed to import.meta.env
#Only prefixed variables are exposed:
ADDONOVA_*VITE_*
Along with built-ins:
| Name | Value |
|---|---|
MODE |
development or production |
DEV |
true in development |
PROD |
true in production |
BROWSER |
Selected target |
MANIFEST_VERSION |
2 or 3 |
Unprefixed variables are never exposed.
# .env
ADDONOVA_API_URL=https://api.example.com
VITE_ANALYTICS_ID=abc123
SECRET_TOKEN=not-exposed
console.log(import.meta.env.ADDONOVA_API_URL);
console.log(import.meta.env.BROWSER);
CLI environment controls
#| Variable | Description |
|---|---|
NO_COLOR |
Disable colored output. |
FORCE_COLOR |
Force colored output. |
Build-time target defines
#In bundle mode, __ADDONOVA_BROWSER__ is defined as the target name. Disable it
with browserApi: { mode: 'bundle', define: false }.