vite.config.ts 963 B

123456789101112131415161718192021222324252627282930313233343536
  1. import path from 'path';
  2. import { defineConfig, loadEnv } from 'vite';
  3. import react from '@vitejs/plugin-react';
  4. import tailwindcss from '@tailwindcss/vite';
  5. export default defineConfig(({ mode }) => {
  6. const env = loadEnv(mode, '.', '');
  7. return {
  8. server: {
  9. port: Number(env.VITE_PORT) || 13001,
  10. host: env.VITE_HOST || '0.0.0.0',
  11. proxy: {
  12. '/api': {
  13. target: env.VITE_BACKEND_URL || 'http://localhost:3001',
  14. changeOrigin: true,
  15. },
  16. '/uploads': {
  17. target: env.VITE_BACKEND_URL || 'http://localhost:3001',
  18. changeOrigin: true,
  19. },
  20. },
  21. },
  22. plugins: [tailwindcss(), react()],
  23. define: {
  24. 'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
  25. 'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
  26. },
  27. resolve: {
  28. alias: {
  29. '@': path.resolve(__dirname, '.'),
  30. }
  31. },
  32. publicDir: 'public'
  33. };
  34. });
  35. // touch