vite.config.ts 929 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { defineConfig } from 'vite';
  2. import react from '@vitejs/plugin-react';
  3. export default defineConfig({
  4. plugins: [react()],
  5. // Use relative paths so the app works when served from any subdirectory
  6. base: './',
  7. build: {
  8. // Output to dist folder
  9. outDir: 'dist',
  10. // Generate assets with relative paths
  11. assetsDir: 'assets',
  12. // Emit a single index.html that can be served by the backend
  13. rollupOptions: {
  14. output: {
  15. // Use hash in filenames for cache busting
  16. entryFileNames: 'assets/[name]-[hash].js',
  17. chunkFileNames: 'assets/[name]-[hash].js',
  18. assetFileNames: 'assets/[name]-[hash].[ext]',
  19. },
  20. },
  21. },
  22. server: {
  23. port: 3000,
  24. proxy: {
  25. '/api': {
  26. target: 'http://localhost:8080',
  27. changeOrigin: true,
  28. },
  29. '/storage': {
  30. target: 'http://localhost:8080',
  31. changeOrigin: true,
  32. },
  33. },
  34. },
  35. });