import { fileURLToPath, URL } from 'node:url' import { defineConfig, loadEnv } from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig(mode => { const env = loadEnv(mode.mode, process.cwd()) const proxytarget = env.VITE_PROXY_TARGET || 'http://localhost:8080' return { plugins: [vue()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { proxy: { [env.VITE_API_URL]: { target: proxytarget, changeOrigin: true, rewrite: path => path.replace(env.VITE_API_URL, '') } } } } })