Bläddra i källkod

fix(build): Copy wv2 runtime in dev, fixes #7373 (#7419)

Fabian-Lars 2 år sedan
förälder
incheckning
290e366ae9
2 ändrade filer med 13 tillägg och 2 borttagningar
  1. 5 0
      .changes/tauri-build-copy-webview2-runtime.md
  2. 8 2
      core/tauri-build/src/lib.rs

+ 5 - 0
.changes/tauri-build-copy-webview2-runtime.md

@@ -0,0 +1,5 @@
+---
+'tauri-build': 'patch:bug'
+---
+
+Correctly copy the WebView2 runtime in development when `webviewInstallMode` is used instead of `webviewFixedRuntimePath`.

+ 8 - 2
core/tauri-build/src/lib.rs

@@ -9,7 +9,7 @@ use cargo_toml::Manifest;
 use heck::AsShoutySnakeCase;
 
 use tauri_utils::{
-  config::Config,
+  config::{Config, WebviewInstallMode},
   resources::{external_binaries, resource_relpath, ResourcePaths},
 };
 
@@ -347,7 +347,13 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
   let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default();
   if target_triple.contains("windows") {
     if let Some(fixed_webview2_runtime_path) =
-      &config.tauri.bundle.windows.webview_fixed_runtime_path
+      match &config.tauri.bundle.windows.webview_fixed_runtime_path {
+        Some(path) => Some(path),
+        None => match &config.tauri.bundle.windows.webview_install_mode {
+          WebviewInstallMode::FixedRuntime { path } => Some(path),
+          _ => None,
+        },
+      }
     {
       resources.push(fixed_webview2_runtime_path.display().to_string());
     }