Web size: deployable web builds go through package.sh, a plain trunk build is over the gate (#2720)

This commit is contained in:
bflatastic
2026-12-03 22:23:28 +07:00
parent d8ecd59932
commit 46abe9602a
3 changed files with 10 additions and 4 deletions
+3 -1
View File
@@ -1,4 +1,6 @@
# Build with: trunk build --release (from apps/figcraft-web)
# Build with: trunk build --release (from apps/figcraft-web) for local testing only.
# Deployable builds go through packaging/web/package.sh: it adds -Zlocation-detail=none, without
# which the wasm is over the 25 MiB size gate (#2720).
[build]
target = "index.html"
dist = "../../dist/web"
+3 -1
View File
@@ -2,7 +2,9 @@
//!
//! Runs the same [`figcraft_ui_egui::FigApp`] as the desktop app through eframe's web runner
//! (wgpu: WebGPU where available, WebGL2 otherwise). Build with `trunk build --release` from this
//! directory; the site lands in `dist/web` (see `packaging/web/README.md`).
//! directory to test locally; the site lands in `dist/web`. A site to deploy is built with
//! `packaging/web/package.sh`, which adds the flags that keep the wasm under the hosts' 25 MiB
//! file cap (see `packaging/web/README.md`).
//!
//! Differences from the desktop app:
//! - no TCP control server (browsers can't listen on sockets);
+4 -2
View File
@@ -214,11 +214,13 @@ tar -xzf figcraft-<v>-freebsd-x86_64.tar.gz --strip-components 1 -C /usr/local
### Web
`packaging/web/package.sh` runs `trunk build --release` in `apps/figcraft-web` (`Trunk.toml`:
`public_url = "./"`, output `dist/web`), fails if a `.wasm` exceeds 24 MiB, and zips the site
`public_url = "./"`, output `dist/web`) with `-Zlocation-detail=none` (no file:line in panic
messages; `RUSTC_BOOTSTRAP=1` for that build only), fails if a `.wasm` exceeds 25 MiB, and zips the site
with sample `_headers`/`.htaccess` and the hosting guide. The app uses WebGPU with a WebGL2
fallback; `?webgl` forces WebGL2. 0.1.0: wasm 17.7 MiB raw, 6.7 MiB gzip, 4.4 MiB Brotli.
`apps/figcraft-web/.cargo/config.toml` builds it with wasm SIMD (`+simd128`), which keeps the
glyph rasterizer's scalar fallback out of the module.
glyph rasterizer's scalar fallback out of the module. A plain `trunk build --release` lacks the
location flag and is over the gate: use it for local testing, and `package.sh` for any site you deploy.
The wasm is built with the size-optimised `web-release` Cargo profile (`opt-level = "s"`, fat
LTO, one codegen unit; `data-cargo-profile` in `apps/figcraft-web/index.html`) and then