fediwall/vite.config.ts

39 lines
951 B
TypeScript
Raw Normal View History

2023-07-25 09:49:32 +02:00
import { fileURLToPath, URL } from "node:url";
2023-07-14 01:10:29 +02:00
2023-07-25 09:49:32 +02:00
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import viteCompression from "vite-plugin-compression";
import { gitDescribeSync } from "git-describe";
import viteLegacy from "@vitejs/plugin-legacy";
2023-07-25 09:49:32 +02:00
let version;
try {
2023-07-25 09:49:32 +02:00
const gitInfo = gitDescribeSync();
if (gitInfo.tag) {
version = `${gitInfo.tag}`;
if (gitInfo.distance)
version += `-${gitInfo.distance}+${gitInfo.hash}`;
}
} catch { ; }
2023-07-14 01:10:29 +02:00
// https://vitejs.dev/config/
export default defineConfig({
2023-07-25 09:49:32 +02:00
base: "./",
define: {
__VERSION__: JSON.stringify(version)
},
plugins: [
vue(),
viteCompression(),
viteLegacy({
targets: 'last 2 versions and not dead, > 0.2%, Firefox ESR, Android >= 7'
}),
2023-07-25 09:49:32 +02:00
],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url))
}
2023-07-14 01:10:29 +02:00
}
2023-07-25 09:49:32 +02:00
});