-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
39 lines (35 loc) · 1003 Bytes
/
vite.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { fileURLToPath, URL } from "node:url";
import { execSync } from "node:child_process";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vuetify from "vite-plugin-vuetify";
// Helper to get Git commit hash
function getGitCommitHash() {
try {
return execSync("git rev-parse --short HEAD").toString().trim();
} catch (error) {
console.warn("Unable to get Git commit hash:", error);
return "unknown";
}
}
// Generate build time
const buildTime = new Date().toISOString();
const packageVersion = process.env.npm_package_version;
// Combine version, commit hash, and build time
const buildVersion = `${packageVersion} / ${getGitCommitHash()} / ${buildTime}`;
export default defineConfig({
plugins: [
vue(),
vuetify({
autoImport: true,
}),
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
define: {
"process.env.BUILD_VERSION": JSON.stringify(buildVersion),
},
});