vite.config.js 519 B

1234567891011121314151617181920212223
  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. return {
  6. plugins: [vue()],
  7. server: {
  8. host: '0.0.0.0',
  9. port: Number(env.VITE_APP_PORT) || 3000,
  10. open: true,
  11. proxy: {
  12. '/api': {
  13. target: 'http://localhost:8080',
  14. changeOrigin: true,
  15. ws: true,
  16. rewrite: (path) => path.replace(/^\/api/, '')
  17. }
  18. }
  19. }
  20. }
  21. })