From 76341d41c3afb2c4e0e65f13f3676dd8d89e767c Mon Sep 17 00:00:00 2001 From: JSR Date: Sat, 28 Mar 2026 09:16:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E7=9C=9F=E6=9C=BA=E5=BC=80=E5=8F=91=E7=89=88=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E4=B8=8E=E7=BC=96=E8=AF=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/commands/window.rs | 2 +- vite.config.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/commands/window.rs b/src-tauri/src/commands/window.rs index 770fa93..0b29a1b 100644 --- a/src-tauri/src/commands/window.rs +++ b/src-tauri/src/commands/window.rs @@ -100,7 +100,7 @@ pub async fn toggle_devtools( let _ = app; } - #[cfg(debug_assertions)] + #[cfg(all(debug_assertions, desktop))] if let Some(window) = app.get_webview_window("main") { if window.is_devtools_open() { window.close_devtools(); diff --git a/vite.config.ts b/vite.config.ts index efac6a8..f866ea9 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -18,8 +18,16 @@ export default defineConfig({ emptyOutDir: true, }, server: { + host: process.env.TAURI_DEV_HOST || false, port: 1420, strictPort: true, + hmr: process.env.TAURI_DEV_HOST + ? { + protocol: "ws", + host: process.env.TAURI_DEV_HOST, + port: 1421, + } + : undefined, }, clearScreen: false, })