vite.config.ts 916 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineConfig } from 'vite'
  2. import path from 'path'
  3. import tailwindcss from '@tailwindcss/vite'
  4. import react from '@vitejs/plugin-react'
  5. export default defineConfig({
  6. base: process.env.VITE_APP_BASE_PATH || '/',
  7. plugins: [
  8. // The React and Tailwind plugins are both required for Make, even if
  9. // Tailwind is not being actively used – do not remove them
  10. react(),
  11. tailwindcss(),
  12. ],
  13. resolve: {
  14. alias: {
  15. // Alias @ to the src directory
  16. '@': path.resolve(__dirname, './src'),
  17. },
  18. },
  19. // File types to support raw imports. Never add .css, .tsx, or .ts files to this.
  20. assetsInclude: ['**/*.svg', '**/*.csv'],
  21. server: {
  22. port: 5173,
  23. // 开发期代理 /api 到后端 Spring Boot(8080);生产由 Nginx 反代,无需此配置
  24. proxy: {
  25. '/api': {
  26. target: 'http://localhost:8080',
  27. changeOrigin: true,
  28. },
  29. },
  30. },
  31. })