Env Variables
kirbyup exposes environment variables on import.meta.env. Three are always set:
import.meta.env.MODE:developmentorproduction.import.meta.env.DEV:truein development.import.meta.env.PROD:truein production, the opposite ofDEV.
Production builds replace them statically and drop dead branches. Write the full property name, import.meta.env[key] is not replaced.
js
// Removed from the production bundle
if (import.meta.env.DEV) {
console.log(this.$panel.view.title)
}.env Files
Vite loads .env and .env.local from the project root. Only variables prefixed with KIRBYUP_ or VITE_ reach the bundle, everything else stays on the server side.
ini
# .env
DB_PASSWORD=secret
KIRBYUP_API_BASE=https://example.test/apijs
console.log(import.meta.env.KIRBYUP_API_BASE) // 'https://example.test/api'
console.log(import.meta.env.DB_PASSWORD) // undefinedThe value is inlined into index.js, so treat every prefixed variable as public.