cli: `[web.wasm_opt] keep_names = true` does not keep the wasm name section in release builds
Problem
Setting keep_names = true in Dioxus.toml [web.wasm_opt] has no observable effect on a 0.7.9 release web build: the shipped .wasm still has its name section stripped (a ~5-byte stub instead of the expected several hundred KB for a ~2 MB module). This makes function-level size attribution (twiggy & friends) and readable production stack traces impossible via the documented knob.
Reproduction
dioxus-cli 0.7.9, dioxus = { version = "0.7", features = ["web"] }, Rust 1.97.
Dioxus.toml:
[application]
name = "web"
[web.app]
title = "…"
[web.wasm_opt]
keep_names = true
Two builds tried:
dx build --release --debug-symbols false+keep_names = true→ shipped wasm 2 065 315 B, twiggy shows only unnamedcode[N]items ("function names" subsection absent).dx build --release(debug-symbols default true) +keep_names = true→ shipped wasm 2 069 084 B (+3.7 KB — not a name section, which for this module is ~726 KB), still onlycode[N], no names.
Control: the pre-bindgen cargo build --release --target wasm32-unknown-unknown artifact of the same workspace has a proper 726 245 B "function names" subsection, so the names exist before the dx pipeline and are removed somewhere in wasm-bindgen/wasm-opt post-processing despite keep_names = true.
For contrast, WasmOptConfig.level from the same section IS honored (verified separately), so the section itself is being read.
Expected
keep_names = true produces a .wasm with the name section intact (docs describe it as keeping names for debugging at a size cost), or the docs/config note what else is required to make it effective.
Environment
- dioxus / dioxus-cli 0.7.9
- binaryen version_129 (auto-installed by dx), wasm-opt completed successfully in both builds (no errors in the log)
- rustc 1.97,
wasm32-unknown-unknown, Dockerrust:1.97-slim-trixie, linux/arm64
Minimal reproduction confirming this on a clean hello-world (same 11-line app as in the minimal repro posted on #5705 — dioxus = { version = "0.7", features = ["web"] }, dioxus-cli 0.7.9, rustc 1.97).
Dioxus.toml:
[application]
name = "repro"
[web.app]
title = "repro"
[web.wasm_opt]
keep_names = true
Built with dx build --release --debug-symbols false (the explicit flag is needed to sidestep #5705 — with the default --debug-symbols true, wasm-opt SIGABRTs on this repro and the whole comparison is moot).
Result: shipped wasm is 463 107 B — byte-identical in size to the same build without keep_names, and twiggy sees only unnamed items:
Shallow Bytes │ Shallow % │ Item
───────────────┼───────────┼─────────────
15175 ┊ 3.28% ┊ code[480]
14276 ┊ 3.08% ┊ data[1]
10702 ┊ 2.31% ┊ code[132]
...
A name section for even this small module would be tens of KB, so keep_names = true demonstrably contributes nothing to the output. Same result on my real-world workspace both with and without --debug-symbols false (2 MB module, expected name section ~726 KB per the pre-bindgen artifact, shipped name section is a 5 B stub).