From 9952f7d6b0d3ff32c4e78519fb023dab59017dea Mon Sep 17 00:00:00 2001 From: Sergey Kozyrenko Date: Fri, 17 Jul 2026 15:44:45 +0700 Subject: [PATCH] chore(frontend): let `vite preview` reach the API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The proxy was only declared under `server`, so `vite preview` served the production build with no route to the backend: every /api/v1 call 404'd and the built app could not get past the login screen. That left the production bundle effectively untestable, which is where chunking — and the bug that made every route download recharts — only ever shows up; `vite dev` does not chunk at all. Reuse the dev proxy for preview, on VITE_PORT+100 so it cannot collide with the dev server. Verified: preview serves on 8100 and /api/v1/info returns 200 through the proxy. Co-Authored-By: Claude Opus 4.8 --- frontend/vite.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 2a57e5cf..45458b3d 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -138,6 +138,9 @@ export default defineConfig(({ mode }) => { '@': path.resolve(__dirname, './src'), }, }, + // `vite preview` serves the production build, which is the only place chunking exists — + // but it has no proxy of its own, so without this the built app cannot reach the API. + preview: { ...serverConfig, port: vitePort + 100 }, server: serverConfig, }; });