vite.config.js 500 B

123456789101112131415161718192021
  1. import { defineConfig, loadEnv } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. export default defineConfig(({ mode }) => {
  4. const env = loadEnv(mode, process.cwd())
  5. const apiBaseUrl = env.VITE_API_BASE_URL || '/api'
  6. const apiProxyTarget = env.VITE_API_PROXY_TARGET || 'http://localhost:9028'
  7. return {
  8. plugins: [vue()],
  9. server: {
  10. port: 5173,
  11. proxy: {
  12. [apiBaseUrl]: {
  13. target: apiProxyTarget,
  14. changeOrigin: true
  15. }
  16. }
  17. }
  18. }
  19. })