앱 버전표시
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
import { readFileSync } from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -9,6 +10,16 @@ const sharedRoot = path.resolve(__dirname, '../packages/shared/src');
|
||||
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
function readDesktopAppVersion(): string {
|
||||
try {
|
||||
const confPath = path.resolve(__dirname, 'src-tauri/tauri.conf.json');
|
||||
const conf = JSON.parse(readFileSync(confPath, 'utf8')) as { version?: string };
|
||||
return String(conf.version ?? '0.0.0');
|
||||
} catch {
|
||||
return '0.0.0';
|
||||
}
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
/** Tauri 패키지 앱 — 절대 경로(/assets) 사용 시 빈 화면 */
|
||||
base: './',
|
||||
@@ -18,6 +29,7 @@ export default defineConfig({
|
||||
/** desktop은 항상 exdev 서버 (localhost 금지) */
|
||||
'import.meta.env.VITE_API_BASE_URL': JSON.stringify('http://exdev.co.kr/api'),
|
||||
__DESKTOP_CLIENT__: 'true',
|
||||
__DESKTOP_APP_VERSION__: JSON.stringify(readDesktopAppVersion()),
|
||||
},
|
||||
envDir: __dirname,
|
||||
plugins: [react()],
|
||||
|
||||
Reference in New Issue
Block a user