chore(build): automatically embed git commit hash in version string

This commit is contained in:
2026-07-06 12:52:20 +00:00
parent 944ae4074e
commit 59846fc1e4
+9 -1
View File
@@ -1,7 +1,15 @@
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import { execSync } from 'child_process'
const gitSha = process.env.GIT_SHA || 'dev' let gitSha = process.env.GIT_SHA
if (!gitSha) {
try {
gitSha = execSync('git rev-parse --short HEAD').toString().trim()
} catch (e) {
gitSha = 'dev'
}
}
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({