浏览代码

fix: stop failing silently (#3682)

Miles Murgaw 4 月之前
父节点
当前提交
8b9e246044
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      packages/cli/src/cli/bundle.rs

+ 9 - 1
packages/cli/src/cli/bundle.rs

@@ -1,5 +1,5 @@
 use crate::{AppBundle, BuildArgs, Builder, DioxusCrate, Platform};
-use anyhow::Context;
+use anyhow::{anyhow, Context};
 use path_absolutize::Absolutize;
 use std::collections::HashMap;
 use tauri_bundler::{BundleBinary, BundleSettings, PackageSettings, SettingsBuilder};
@@ -159,6 +159,14 @@ impl Bundle {
 
         let mut bundle_settings: BundleSettings = krate.config.bundle.clone().into();
 
+        // Check if required fields are provided instead of failing silently.
+        if bundle_settings.identifier.is_none() {
+            return Err(anyhow!("\n\nBundle identifier was not provided in `Dioxus.toml`. Add it as:\n\n[bundle]\nidentifier = \"com.mycompany\"\n\n").into());
+        }
+        if bundle_settings.publisher.is_none() {
+            return Err(anyhow!("\n\nBundle publisher was not provided in `Dioxus.toml`. Add it as:\n\n[bundle]\npublisher = \"MyCompany\"\n\n").into());
+        }
+
         if cfg!(windows) {
             let windows_icon_override = krate.config.bundle.windows.as_ref().map(|w| &w.icon_path);
             if windows_icon_override.is_none() {