앱 버전표시
This commit is contained in:
+19
-1
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user