From 46d5fd0b0cd07e3c46fb1323051704a009a09868 Mon Sep 17 00:00:00 2001 From: arsam Date: Fri, 18 Sep 2026 23:17:53 +0330 Subject: [PATCH] Import project configuration: app/vite.config.js Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality. --- app/vite.config.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app/vite.config.js diff --git a/app/vite.config.js b/app/vite.config.js new file mode 100644 index 0000000..1722917 --- /dev/null +++ b/app/vite.config.js @@ -0,0 +1,52 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +// Vite config: bundles React + JSX at build time (no CDN, no Babel-Standalone), +// emits hashed assets, copies /public/* (incl. fonts) to dist/. +export default defineConfig({ + root: '.', + publicDir: 'public', + server: { + port: 3009, + host: '0.0.0.0', + strictPort: true, + proxy: { + // Forward /api/* to the Fastify backend so the browser sees same-origin + // cookies in dev. Production goes through Caddy with the same path-based + // routing — the frontend code never needs to know which is in use. + '/api': { + target: 'http://localhost:3010', + changeOrigin: false, + }, + }, + }, + preview: { port: 3009, host: '0.0.0.0', strictPort: true }, + build: { + outDir: 'dist', + sourcemap: true, + target: 'es2020', + cssCodeSplit: true, + // Keep imported icon SVGs as real hashed files (never base64-inlined) so they + // serve from /assets/ with gzip_static/brotli_static and CSS mask URLs stay clean. + assetsInlineLimit(filePath) { + if (filePath.includes('assets/icons/')) return false; + // any other asset → Vite's default size-based inlining + }, + rollupOptions: { + input: { + main: 'index.html', + embed: 'embed.html', + }, + output: { + // Group React separately so the vendor bundle is cacheable across deploys. + manualChunks(id) { + if (id.includes('node_modules/react')) return 'vendor-react'; + if (id.includes('node_modules/three')) return 'vendor-three'; + if (id.includes('node_modules/d3') || id.includes('node_modules/d3-')) return 'vendor-d3'; + if (id.includes('node_modules')) return 'vendor'; + }, + }, + }, + }, + plugins: [react()], +});