앱 버전표시

This commit is contained in:
Macbook
2026-06-14 19:20:48 +09:00
parent b2c6650cd5
commit 5045a548a4
10 changed files with 137 additions and 31 deletions
+19 -1
View File
@@ -20,6 +20,24 @@ function readDesktopAppVersion(): string {
}
}
const desktopVersion = readDesktopAppVersion();
const desktopWindowTitle = `GoldenChart (v${desktopVersion})`;
function desktopHtmlTitlePlugin() {
return {
name: 'desktop-html-title',
transformIndexHtml(html: string, ctx: { filename: string }) {
if (!ctx.filename.endsWith('index.html')) return html;
return html
.replace(/<title>[^<]*<\/title>/i, `<title>${desktopWindowTitle}</title>`)
.replace(
'<script>var global = globalThis;</script>',
`<script>var global = globalThis;window.__GC_APP_VERSION__="${desktopVersion}";</script>`,
);
},
};
}
export default defineConfig({
/** Tauri 패키지 앱 — 절대 경로(/assets) 사용 시 빈 화면 */
base: './',
@@ -32,7 +50,7 @@ export default defineConfig({
__DESKTOP_APP_VERSION__: JSON.stringify(readDesktopAppVersion()),
},
envDir: __dirname,
plugins: [react()],
plugins: [react(), desktopHtmlTitlePlugin()],
resolve: {
dedupe: ['react', 'react-dom', 'lightweight-charts'],
alias: {