statically link WebView2Loader to resolve missing dll error

This commit is contained in:
2026-08-22 20:41:38 -07:00
parent 21a4120c0a
commit b23e9327a1
5 changed files with 37 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "vyla-home",
"version": "1.0.8",
"version": "1.0.9",
"description": "Vyla Home Desktop App Launcher",
"main": "main.js",
"scripts": {

2
src-tauri/Cargo.lock generated
View File

@@ -4222,7 +4222,7 @@ dependencies = [
[[package]]
name = "vyla-home"
version = "1.0.8"
version = "1.0.9"
dependencies = [
"serde",
"serde_json",

View File

@@ -1,6 +1,6 @@
[package]
name = "vyla-home"
version = "1.0.8"
version = "1.0.9"
description = "Vyla Home Desktop App Launcher"
edition = "2021"

View File

@@ -1,3 +1,35 @@
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
tauri_build::build()
tauri_build::build();
if env::var("CARGO_CFG_TARGET_OS").unwrap_or_default() == "windows" {
let target_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
.ancestors()
.nth(3)
.unwrap()
.to_path_buf();
let build_dir = PathBuf::from(env::var("OUT_DIR").unwrap())
.ancestors()
.nth(2)
.unwrap()
.to_path_buf();
if let Ok(entries) = fs::read_dir(&build_dir) {
for entry in entries.flatten() {
let name = entry.file_name().to_string_lossy().to_string();
if name.starts_with("webview2-com-sys-") {
let dll_path = entry.path().join("out").join("x64").join("WebView2Loader.dll");
if dll_path.exists() {
let _ = fs::copy(&dll_path, target_dir.join("WebView2Loader.dll"));
let _ = fs::copy(&dll_path, PathBuf::from("../bin").join("WebView2Loader.dll"));
break;
}
}
}
}
}
}

View File

@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Vyla Home",
"version": "1.0.8",
"version": "1.0.9",
"identifier": "com.vyla.home",
"build": {
"frontendDist": "../ui"