Closed
Description
Smallest example that reproduces this bug:
#[wasm_bindgen]
pub struct S;
#[wasm_bindgen]
pub fn create_s() -> S {
S
}
The generated JS file (with --no-modules
) contains something like this:
__exports.create_s = function() {
return S.__construct(wasm.create_s());
}
__exports.S = class S {
// ...
}
When I call the create_s
function it fails with ReferenceError: S is not defined
.
If I modify the JS file either to call __exports.S.__construct
or export the class as let S = null; __exports.S = S = class S { ... }
then it works as supposed.
The second way seems like a really easy fix, I'll create a pull request.
Metadata
Metadata
Assignees
Labels
No labels