parse exception: duplicate export name
Some of Yew's example crates (but not all) fail to build in our binary size comparison CI because of wasm-opt
https://github.com/yewstack/yew/actions/runs/19726188911/job/56517994922?pr=3949#step:9:676
[parse exception: duplicate export name (at 0:8529)]
Fatal: error parsing wasm (try --debug for more info)
2025-11-27T05:32:21.251418Z ERROR ❌ error
error from build pipeline
Caused by:
0: HTML build pipeline failed (1 errors), showing first
1: error from asset pipeline
2: running wasm-opt
3: wasm-opt call to executable '/home/runner/.cache/trunk/wasm-opt-version_125/bin/wasm-opt' with args: '["--output=/home/runner/work/yew/yew/target/wasm-opt/release/function_router_bg.wasm", "-O", "/home/runner/work/yew/yew/dist/function_router/.stage/function_router-93f56f6c1d2b72c_bg.wasm"]' returned a bad status: exit status: 1
2025-11-27T05:32:21.251443Z ERROR error from build pipeline
2025-11-27T05:32:21.251452Z INFO 1: HTML build pipeline failed (1 errors), showing first
2025-11-27T05:32:21.251454Z INFO 2: error from asset pipeline
2025-11-27T05:32:21.251455Z INFO 3: running wasm-opt
2025-11-27T05:32:21.251456Z INFO 4: wasm-opt call to executable '/home/runner/.cache/trunk/wasm-opt-version_125/bin/wasm-opt' with args: '["--output=/home/runner/work/yew/yew/target/wasm-opt/release/function_router_bg.wasm", "-O", "/home/runner/work/yew/yew/dist/function_router/.stage/function_router-93f56f6c1d2b72c_bg.wasm"]' returned a bad status: exit status: 1
Please provide a wasm file to reproduce this issue.
Is it possible that wasm-opt is correct and there actually are duplicate export names? If so, this would be working as intended because duplicate export names are disallowed by the Wasm spec.
here is the file wasm-bindgen version 0.2.105 wasm-opt 125 fails to process it
https://drive.google.com/file/d/16EDQBi9VgWljtqevKAwmukXBh7z3WlJg/view?usp=sharing
alternatively this can be generate by
gh repo clone yewstack/yew
cd yew/examples/function_router
trunk build --release
The wasm will be generated to function_router/dist/.stage
Is it possible that wasm-opt is correct and there actually are duplicate export names?
Not sure how I check that... the failing PR https://github.com/yewstack/yew/pull/3949 bumps the versions of some deps and consolidated some deps as workspace dependencies. Other later commits to the yew repo don't trigger the issue. I can try to isolate the minimum change to trigger the error if it's helpful.
There is indeed at least one duplicate export: wasm_bindgen_b6b266dc1a4d1fd9___convert__closures________invoke___web_sys_cd0631b8eb5639e2___features__gen_Event__Event_____. The bug must be in something that runs before wasm-opt.
oof, that sounds like really bad news. Can I get more pointers on where to look at or ask for help?
The function name mentions wasm_bindgen, so I would guess the bug is there. To confirm, you can try the wasm file before running wasm-bindgen and after.
thanks!