import { readFileSync } from "node:fs";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

// Read once at config-eval time — same trick as apps/web's vite.config.ts.
const pkg = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf-8"));

export default defineConfig({
  plugins: [react()],
  server: { port: 5174 },
  css: {
    preprocessorOptions: {
      scss: { api: "modern-compiler" },
    },
  },
  define: {
    __APP_VERSION__: JSON.stringify(pkg.version),
  },
});
