打包与发布约 3 分钟
编译为二进制文件
用 bun build --compile 把应用编译成自带渲染器的单个可执行文件。
bun build --compile app.tsx --outfile dist/app
./dist/app
该二进制自带渲染器,因此运行时无需 Bun,也无需安装 Node。
实测体积对照:在本机上,Bun 版 chat 的 .app 为 82 MB。Hermes 版 counter 的 .app 为 34 MB。完整的图标与签名流程见打包成带图标的 App。
三个平台
Packager 只构建宿主操作系统。请在 macOS、Linux 与 Windows 上分别运行。
# macOS
bun build --compile app.tsx --outfile dist/app
# Linux
bun build --compile app.tsx --outfile dist/app
# Windows
bun build --compile app.tsx --outfile dist/app.exe
注意 Windows 的输出文件名带 .exe 后缀,而 macOS 与 Linux 不带。后续 packager 使用的 binariesDir 与这个文件名一致。
下一步
| 目标 | 页面 |
|---|---|
生成 .app / .AppImage / setup .exe |
打包成带图标的 App |
| 让应用能自我更新 | 自动更新 |