diff --git a/Cargo.toml b/Cargo.toml index 8c4142e6..0f435818 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,7 +133,7 @@ lto = "thin" codegen-units = 4 # The browser build only (apps/figcraft-web/index.html: data-cargo-profile). Optimised for size: -# packaging/web/package.sh fails a .wasm over 24 MiB (Cloudflare's per-file cap is 25 MiB). +# packaging/web/package.sh fails a .wasm over 25 MiB - 512 KiB (Cloudflare's per-file cap is 25 MiB). # wasm32-unknown-unknown always aborts on panic, so panic = "abort" changes nothing there. [profile.web-release] inherits = "release" diff --git a/docs/releasing.md b/docs/releasing.md index 8ad7e614..4769c518 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -195,7 +195,7 @@ 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`), fails if a `.wasm` exceeds 25 MiB minus 512 KiB, 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. diff --git a/packaging/web/README.md b/packaging/web/README.md index e17be23e..24131b0a 100644 --- a/packaging/web/README.md +++ b/packaging/web/README.md @@ -37,7 +37,7 @@ Measured on the 0.1.0 build (`trunk build --release`; gzip `-9`, Brotli quality Per-file upload limits: Cloudflare Pages and Workers static assets reject any file over **25 MiB** (26,214,400 bytes). `packaging/web/package.sh` fails the build if the wasm ever grows -past 24 MiB, so a release can't ship a file a common host refuses. +past 25 MiB minus 512 KiB (25,690,112 bytes), so a release can't ship a file a common host refuses. ## Any path works diff --git a/packaging/web/package.sh b/packaging/web/package.sh index f9ee34a7..a29bad31 100755 --- a/packaging/web/package.sh +++ b/packaging/web/package.sh @@ -27,7 +27,9 @@ fi # Size gate: Cloudflare Pages/Workers reject any single file over 25 MiB, and other # hosts and CDNs have similar caps. Fail well before that so a regression shows up here, not at # upload time. Override with FIGCRAFT_WASM_MAX_BYTES only to investigate. -MAX_WASM_BYTES="${FIGCRAFT_WASM_MAX_BYTES:-25165824}" # 24 MiB +# 25 MiB - 512 KiB: raised from 24 MiB for 0.12.1, when egui 0.37 and new features took the wasm to +# 25.3 MB with opt-level z and wasm-opt -Oz already applied. Cutting the wasm back down is open work. +MAX_WASM_BYTES="${FIGCRAFT_WASM_MAX_BYTES:-25690112}" # 25 MiB - 512 KiB WASM_COUNT=0 for wasm in "$SITE"/*.wasm; do [[ -f "$wasm" ]] || continue