Add frontend version

This commit is contained in:
lowcarbdev
2025-11-15 15:08:43 -07:00
parent 557ad1fc46
commit 848bf84341
4 changed files with 40 additions and 0 deletions
+15
View File
@@ -1,7 +1,22 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { readFileSync } from 'fs'
import { resolve } from 'path'
// Read version from version.json
let version = 'unknown'
try {
const versionFile = readFileSync(resolve(__dirname, 'version.json'), 'utf-8')
const versionData = JSON.parse(versionFile)
version = versionData.version
} catch (error) {
console.warn('Warning: Could not read version.json, using default version')
}
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify(version),
},
})