P2Pix-Front-End/vite.config.ts
2025-10-31 07:14:44 -03:00

47 lines
1.0 KiB
TypeScript

import { fileURLToPath, URL } from "node:url";
import { execSync } from "node:child_process";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
import svgLoader from "vite-svg-loader";
function getGitCommitHash(): string {
try {
return execSync("git rev-parse --short HEAD").toString().trim();
} catch (error) {
return "unknown";
}
}
// https://vitejs.dev/config/
export default defineConfig({
base: "./",
build: {
target: "esnext",
},
define: {
__APP_VERSION__: JSON.stringify(getGitCommitHash()),
},
optimizeDeps: {
esbuildOptions: {
target: "esnext",
define: {
global: "globalThis",
},
supported: {
bigint: true,
},
},
},
plugins: [vue(), vueJsx(), svgLoader()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
"viem/errors": fileURLToPath(
new URL("./node_modules/viem/errors", import.meta.url)
),
},
},
});