import { defineConfig } from "vite"; import tailwindcss from "@tailwindcss/vite"; import { execSync } from "child_process"; const commitHash = execSync("git rev-parse --short HEAD").toString().trim(); const commitFull = execSync("git rev-parse HEAD").toString().trim(); export default defineConfig({ // The page's source is in web/; the build still goes to dist/ at the // repo root, which Dockerfile and the viewport test serve. Vite // empties only an outDir inside root unless told to. root: "web", plugins: [tailwindcss()], server: { // Proxy /api to a locally running netwatch-server so `yarn dev` // exercises the real report-posting path. proxy: { "/api": "http://127.0.0.1:8080", }, }, define: { __COMMIT_HASH__: JSON.stringify(commitHash), __COMMIT_FULL__: JSON.stringify(commitFull), }, build: { outDir: "../dist", emptyOutDir: true, target: "esnext", minify: "esbuild", cssMinify: true, }, });