diff --git a/astro.config.mjs b/astro.config.mjs index ae72868f8..81f39e18b 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -13,6 +13,11 @@ import deleteUnusedImages from "astro-delete-unused-images"; import preload from "astro-preload"; import { execSync } from "node:child_process"; +let gitVersion = ""; +try { + gitVersion = execSync("git rev-parse --short HEAD 2>&1 > /dev/null"); +} catch (e) {} + // https://astro.build/config export default defineConfig({ vite: { @@ -21,9 +26,7 @@ export default defineConfig({ .toISOString() .replace(/[-:T.Z]/g, "") .slice(0, 14), - "import.meta.env.GIT_VERSION": new String( - execSync("git rev-parse --short HEAD") - ), + "import.meta.env.GIT_VERSION": new String(gitVersion), }, resolve: { alias: {