vite.config.ts 496 B

12345678910111213141516171819202122
  1. import { defineConfig } from 'vite'
  2. import react from '@vitejs/plugin-react'
  3. import path from 'path'
  4. // https://vitejs.dev/config/
  5. export default defineConfig({
  6. plugins: [react()],
  7. resolve: {
  8. alias: {
  9. '@': path.resolve(__dirname, './src'),
  10. },
  11. },
  12. server: {
  13. proxy: {
  14. '/api': {
  15. target: 'http://localhost:8083', // 后端地址
  16. changeOrigin: true,
  17. rewrite: (path) => path.replace(/^\/api/, ''), // 可选:去掉前缀
  18. },
  19. },
  20. },
  21. })