My build appears to be creating a corrupted WASM. ...
# webassembly
d
My build appears to be creating a corrupted WASM. The browser is reporting
wasm validation error: at offset 43269: duplicate export
I have tried to use
wasm2wat
on it from
wabt
but that also reports error
000008f: error: expected valid result type (got -0xf)
Project is using Kotlin 1.9.24
s
Exports (@JsExport, @WasmExport) need to have a unique name, but Kotlin/Wasm currently doesn’t check for duplicate exports. Wabt doesn’t seem to support GC types. I prefer https://github.com/bytecodealliance/wasm-tools
parse
print
command instead.
d
Thanks for this testing with FireFox again now (otherwise I'd be trying to chase wasm2wat working)
I think the issue is (but still confirming now):
Copy code
@OptIn(ExperimentalJsExport::class)
@JsExport
fun myFunction(event: Event, ele: HTMLElement) {
  // this works
}

///// then I changed to
@OptIn(ExperimentalJsExport::class)
@JsExport
fun myFunction(event: Event, ele: HTMLElement? = null) {
  // this is a problem
  // I think the default param must create an extra non-unique symbol 
}
s
d
Does this need to be reported or a known matter ?
s
I’ll file a ticket, thanks!
👍 1