feat: commit code

This commit is contained in:
mrxiaozhuox committed 2022-03-15 18:28:19 +08:00
1 parent 62a2292c16
commit 8b380f2617
1 file changed
+22 -21
+22 -21
View File
@@ -105,29 +105,30 @@ pub fn build(config: &CrateConfig) -> Result<()> {
let binaryen = crate::tools::Tool::Binaryen; let binaryen = crate::tools::Tool::Binaryen;
if !binaryen.is_installed() { if !binaryen.is_installed() {
log::error!("Binaryen tool not found, you can use `dioxus tool add binaryen` to install it."); if let Some(sub) = info.as_table() {
return Ok(()); if sub.contains_key("wasm_opt")
} && sub.get("wasm_opt").unwrap().as_bool().unwrap_or(false)
{
if let Some(sub) = info.as_table() { let target_file = out_dir
if sub.contains_key("wasm_opt") .join("assets")
&& sub.get("wasm_opt").unwrap().as_bool().unwrap_or(false) .join("dioxus")
{ .join(format!("{}_bg.wasm", dioxus_config.application.name));
let target_file = out_dir if target_file.is_file() {
.join("assets") binaryen.call(
.join("dioxus") "wasm-opt",
.join(format!("{}_bg.wasm", dioxus_config.application.name)); vec![
if target_file.is_file() { target_file.to_str().unwrap(),
binaryen.call( "-o",
"wasm-opt", target_file.to_str().unwrap(),
vec![ ],
target_file.to_str().unwrap(), )?;
"-o", }
target_file.to_str().unwrap(),
],
)?;
} }
} }
} else {
log::warn!(
"Binaryen tool not found, you can use `dioxus tool add binaryen` to install it."
);
} }
} }