mirror of
https://github.com/kccleoc/seedpgp-web.git
synced 2026-03-07 01:47:52 +08:00
25 lines
672 B
TypeScript
25 lines
672 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import { execSync } from 'child_process'
|
|
import fs from 'fs'
|
|
|
|
// Read version from package.json
|
|
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
|
const appVersion = packageJson.version
|
|
|
|
// Get git commit hash
|
|
const gitHash = execSync('git rev-parse --short HEAD').toString().trim()
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
base: process.env.CF_PAGES ? '/' : '/seedpgp-web-app/',
|
|
build: {
|
|
outDir: 'dist',
|
|
emptyOutDir: false,
|
|
},
|
|
define: {
|
|
'__APP_VERSION__': JSON.stringify(appVersion),
|
|
'__BUILD_HASH__': JSON.stringify(gitHash),
|
|
}
|
|
})
|