浏览代码

conditional devtools

CGQAQ 3 年之前
父节点
当前提交
030f6d58fb
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 1 1
      packages/desktop/Cargo.toml
  2. 6 1
      packages/desktop/src/desktop_context.rs

+ 1 - 1
packages/desktop/Cargo.toml

@@ -20,7 +20,7 @@ serde = "1.0.136"
 serde_json = "1.0.79"
 thiserror = "1.0.30"
 log = "0.4.14"
-wry = { version = "0.16.0", features = ["devtools"] }
+wry = { version = "0.16.0" }
 futures-channel = "0.3.21"
 tokio = { version = "1.16.1", features = [
     "sync",

+ 6 - 1
packages/desktop/src/desktop_context.rs

@@ -212,7 +212,12 @@ pub(super) fn handler(
                 log::warn!("Open print modal failed: {e}");
             }
         }
-        DevTool => webview.open_devtools(),
+        DevTool => {
+            #[cfg(debug_assertions)]
+            webview.open_devtools();
+            #[cfg(not(debug_assertions))]
+            log::warn!("Devtools are disabled in release builds");
+        }
 
         Eval(code) => {
             if let Err(e) = webview.evaluate_script(code.as_str()) {