I have a VUE app along with vite. But having some problem to access environment variables from vite.config inside pod.
In my ”vite.config” i have a few things that configurable based on environment set by spec in Kubernetes.
- CAN NOT access env-variables in "vite.config" set by Kubernetes in production.
- CAN access env-variables in client-code
- CAN access env-variables when running in dev-mode
- CAN list environment variables inside pod and they are all there.
export default (mode: string) => {
process.env = { ...process.env, ...loadEnv(mode, process.cwd()) };
const APP_BASEURL = process.env.VITE_BASEURL;
// APP_BASEURL always empty
return defineConfig({
base: `${APP_BASEURL}`,
Note: vue application is build with docker.
So my problem - how can i set APP_BASEURL inside my vite.config?