diff options
| author | 2024-08-17 14:30:04 +0100 | |
|---|---|---|
| committer | 2024-08-17 14:30:04 +0100 | |
| commit | 2abd2ac5afea0755e6ad66c1c8d1e3402c646d24 (patch) | |
| tree | c80773b8a544a6eaf484c669b9e72c61bcf5fcb6 | |
| parent | Change card border colour on light theme (diff) | |
Update vite to not crash if not a git repo
| -rw-r--r-- | thallium-frontend/vite.config.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/thallium-frontend/vite.config.ts b/thallium-frontend/vite.config.ts index 46cab18..0c0862f 100644 --- a/thallium-frontend/vite.config.ts +++ b/thallium-frontend/vite.config.ts @@ -2,8 +2,14 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; import * as child from "child_process"; -const commitHash = child.execSync("git rev-parse --short HEAD") - .toString().replace(/\n$/, ""); +let commitHash = "unknown"; + +try { + commitHash = child.execSync("git rev-parse --short HEAD") + .toString().replace(/\n$/, ""); +} catch (e) { + console.error("Failed to get commit hash"); +} // https://vitejs.dev/config/ export default defineConfig({ |