Fundamental_Analysis/frontend/vite.config.ts
Lv, Qi abe47c4bc8 refactor(report): switch to HTML+Gotenberg for high-quality PDF export
- Feat: Add Gotenberg service to docker-compose for headless PDF rendering
- Feat: Implement /generate-pdf endpoint in report-generator-service
- Feat: Add PDF generation proxy route in api-gateway
- Refactor(frontend): Rewrite PDFExportButton to generate HTML with embedded styles and images
- Feat(frontend): Auto-crop React Flow screenshots to remove whitespace
- Style: Optimize report print layout with CSS (margins, image sizing)
- Chore: Remove legacy react-pdf code and font files
2025-11-30 22:43:22 +08:00

47 lines
1.3 KiB
TypeScript

import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
return {
plugins: [react()],
// Explicitly configure public directory behavior if needed,
// but usually 'public' is default.
publicDir: 'public',
optimizeDeps: {
exclude: ['dagre'],
// 'web-worker' needs to be optimized or handled correctly by Vite for elkjs
include: ['elkjs/lib/elk.bundled.js', 'buffer']
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
// Force buffer to resolve to the installed package, not node built-in
buffer: "buffer",
},
},
server: {
// Ensure static files are served correctly
fs: {
strict: false,
},
proxy: {
'/api': {
target: env.VITE_API_TARGET || 'http://localhost:4000',
changeOrigin: true,
},
'/health': {
target: env.VITE_API_TARGET || 'http://localhost:4000',
changeOrigin: true,
},
'/tasks': {
target: env.VITE_API_TARGET || 'http://localhost:4000',
changeOrigin: true,
},
},
},
}
})