[nu-demo] hero_os WASM shell is 211 MB debug — needs release + wasm-opt + brotli/gzip sidecars #140
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
First-load of the Hero OS shell on a fresh browser is 2-3 minutes on a home connection — the WASM blob is 211 MB uncompressed over the wire. Live demo impact: noticeable pause before anything renders.
Root cause
Current
make build-wasmtarget produces a debug-profile WASM with nowasm-optand no compression. Axum'sServeDirinhero_os_uiserves the raw.wasmwith noContent-Encoding: br/gzipsidecar negotiation.Demo workaround (applied 2026-04-23)
None applied at runtime on the demo VM. A compression-analysis agent produced a ready-to-apply patch set (sitting in the repo-local workspace), but we did not apply it during the nu-demo bring-up.
Proper fix
Three changes, combined drop 211 MB -> ~5-8 MB first-load (~40x reduction):
(a) Build WASM via
dx build --web --releaseso Dioxus.toml's wasm-opt-Ozpass runs. Expect ~20 MB uncompressed.(b) Add a Makefile post-build step that produces sidecars next to the
.wasm:(c) In
hero_os_ui, configure AxumServeDir.precompressed_br().precompressed_gzip()so it serves the sidecar on matchingAccept-Encoding.This also establishes the pattern for every other
_uiservice in the Hero stack — they should all adopt the same sidecar + precompressed-serving recipe.Filed 2026-04-23 nu-shell demo bring-up. Signed-off-by: mik-tf
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #163Compression landed + verified live on herodemo
hero_os
c27d9f6: adds acompress-assetsMakefile target and wiresinstall-assets-releaseto call it automatically. Builds .br + .gz sidecars for every .wasm / .js / .html / .css / .json / .svg over 1 KiB.Before / after on herodemo
hero_os_app_bg.wasm(live, today)hero_os_app_bg.wasm(debug, broken)index.htmllivekit.jsThe 215 MB debug bundle was a misstep earlier in the session (
make build-wasmbuilds debug). Release mode (make build) drops the WASM to 9 MB before compression; brotli q11 sidecar drops the wire payload to 1.75 MB — matches the historical good-state target.Server-side wiring
hero_os_uis static handler already negotiates
Accept-Encoding. Verified on herodemo via internal hero_router (port 9990, bypassing nginx auth):Why it wont regress
install-assets-releasenow invokescompress-assetsautomatically — operators cant accidentally skip it.compress-assetsis idempotent and tolerates missing tools (warns about brotli/gzip being absent rather than failing the build).Closing.
Signed-off-by: mik-tf
make demotarget — provision + install + seed + verify a fresh Hero OS demo VM in one command #31