vite.config.ts 1.1 KB

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