chore(frontend): let vite preview reach the API

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 <noreply@anthropic.com>
This commit is contained in:
Sergey Kozyrenko
2026-07-17 15:44:45 +07:00
co-authored by Claude Opus 4.8
parent 6a032c74db
commit 9952f7d6b0
+3
View File
@@ -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,
};
});