Files
Checkmate/client/vite.config.ts
gorkem-bwl f654310c4d fix(client): source app version from package.json
The client version shown on the Settings page was hardcoded as a
literal in vite.config.ts, while client/package.json sat at the
placeholder "0.0.0". Bumping the displayed version required editing
two unrelated places, and stale Docker client images would keep
showing the old number after upgrades.

This change makes client/package.json the single source of truth
and reads it at build time. Bumps client/package.json from 0.0.0
to 3.6.1 to preserve current behaviour.

Closes #3271
2026-04-23 23:33:41 -04:00

33 lines
780 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import svgr from "vite-plugin-svgr";
import path from "path";
import { fileURLToPath } from "url";
import { readFileSync } from "fs";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default defineConfig(({}) => {
const pkg = JSON.parse(readFileSync(path.resolve(__dirname, "package.json"), "utf-8"));
const version = pkg.version;
return {
base: "/",
plugins: [svgr(), react()],
server: {
host: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
optimizeDeps: {
include: ["@mui/material/Tooltip", "@emotion/styled"],
},
define: {
__APP_VERSION__: JSON.stringify(version),
},
};
});