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:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user