fix: StatusBar 版本号改为从 package.json 动态注入

- electron.vite.config.ts 读取 package.json 注入 __APP_VERSION__ 全局常量
- StatusBar.vue 使用 __APP_VERSION__ 替代硬编码 v2.0
- env.d.ts 添加 __APP_VERSION__ 类型声明
This commit is contained in:
2026-07-12 00:37:06 +08:00
parent 19672045d6
commit faedfd7fa3
3 changed files with 9 additions and 2 deletions
+6
View File
@@ -1,6 +1,9 @@
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import { readFileSync } from 'fs'
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
export default defineConfig({
main: {
@@ -17,6 +20,9 @@ export default defineConfig({
},
},
plugins: [vue()],
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
},
server: {
port: 5173,
},