以下链接有关于减少您安装程序的大小的教程:

  • https://github.com/RazrFalcon/cargo-bloat
  • https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html
  • https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections

    Rust 压缩方法

    添加以下代码到 src-tauri/Cargo.toml
    [profile.release] panic = “abort” codegen-units = 1 lto = true incremental = false opt-level = “z”

    UPX

    UPX, 可执行文件的终极打包工具, 是二进制打包中的佼佼者。
    这个有23年历史、维护良好的工具包是GPL-v2许可的,使用相当自由。
    我们对许可的理解是,除非您修改UPX的源代码,否则你可以将其用于任何目的(商业或其他)而不需要开源您的代码。
    基本上,它压缩二进制文件并在运行时解压。
    它应该适用于几乎所有的二进制类型。
    了解更多:https://github.com/upx/upx
    你应该知道,这种技术在Windows和macOS上可能会将你的二进制文件标记为病毒——所以请自行斟酌使用,并一如既往地使用Frida进行验证,并进行真正的分布测试!

    在 macOS 上的使用方法

    $ brew install upx $ yarn tauri build $ upx —ultra-brute src-tauri/target/release/bundle/osx/app.app/Contents/macOS/app Ultimate Packer for eXecutables Copyright (C) 1996 - 2018 UPX 3.95 Markus Oberhumer, Laszlo Molnar & John Reiser Aug 26th 2018 File size Ratio Format Name —————————— ——— —————- —————- 963140 -> 274448 28.50% macho/amd64 app