Files
chore/frontend/vue-app/vite.config.ts
Ryan Kegel a41a357f50
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 1m1s
feat: update Vite configuration to load environment variables for backend host
2026-02-23 16:52:22 -05:00

33 lines
824 B
TypeScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import fs from 'fs'
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const backendHost = env.VITE_BACKEND_HOST ?? '192.168.1.219'
return {
plugins: [vue()],
server: {
host: '0.0.0.0',
https: {
key: fs.readFileSync('./192.168.1.102+1-key.pem'),
cert: fs.readFileSync('./192.168.1.102+1.pem'),
},
proxy: {
'/api': {
target: `http://${backendHost}:5000`,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
}
})