2023-07-14 01:10:29 +02:00
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
import viteCompression from 'vite-plugin-compression';
|
2023-07-20 11:44:25 +02:00
|
|
|
import { gitDescribeSync } from 'git-describe';
|
2023-07-20 16:29:41 +02:00
|
|
|
import viteLegacy from '@vitejs/plugin-legacy'
|
2023-07-20 11:44:25 +02:00
|
|
|
|
|
|
|
var version;
|
|
|
|
|
|
|
|
try {
|
|
|
|
var gitInfo = gitDescribeSync();
|
2023-07-20 12:25:16 +02:00
|
|
|
if(gitInfo.tag) {
|
|
|
|
version = `${gitInfo.tag}`;
|
|
|
|
if (gitInfo.distance)
|
|
|
|
version += `-${gitInfo.distance}+${gitInfo.hash}`
|
|
|
|
}
|
2023-07-20 11:44:25 +02:00
|
|
|
} catch { }
|
2023-07-14 01:10:29 +02:00
|
|
|
|
|
|
|
// https://vitejs.dev/config/
|
|
|
|
export default defineConfig({
|
2023-07-17 16:31:15 +02:00
|
|
|
base: "./",
|
2023-07-20 11:44:25 +02:00
|
|
|
define: {
|
|
|
|
__VERSION__: JSON.stringify(version)
|
|
|
|
},
|
2023-07-14 01:10:29 +02:00
|
|
|
plugins: [
|
2023-07-20 16:29:41 +02:00
|
|
|
vue(),
|
|
|
|
viteCompression(),
|
|
|
|
viteLegacy(),
|
2023-07-14 01:10:29 +02:00
|
|
|
],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|