From 46abe9602a6ecdfd52029d496d57ec45316936eb Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 3 Dec 2026 22:23:28 +0700 Subject: [PATCH] Web size: deployable web builds go through package.sh, a plain trunk build is over the gate (#2720) --- apps/figcraft-web/Trunk.toml | 4 +++- apps/figcraft-web/src/main.rs | 4 +++- docs/releasing.md | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/figcraft-web/Trunk.toml b/apps/figcraft-web/Trunk.toml index e9fe5a5e9..baf962b6d 100644 --- a/apps/figcraft-web/Trunk.toml +++ b/apps/figcraft-web/Trunk.toml @@ -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" diff --git a/apps/figcraft-web/src/main.rs b/apps/figcraft-web/src/main.rs index c5451bc02..0558b0c69 100644 --- a/apps/figcraft-web/src/main.rs +++ b/apps/figcraft-web/src/main.rs @@ -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); diff --git a/docs/releasing.md b/docs/releasing.md index 527987930..6f88d80e6 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -214,11 +214,13 @@ tar -xzf figcraft--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