Following example https://github.com/rustwasm/wasm-bindgen/tree/master/examples/import_js works fine. Next step I try to import a js-module with 2 levels of modules. Let MyClass
instead be referenced with mylib.part1.MyClass
.
In rust wasm-bindgen file I try to import with:
#[wasm_bindgen(module = "/defined-in-js.js")]
extern "C" {
type MyClass;
#[wasm_bindgen(constructor, js_namespace = mylib.part1)]
fn new() -> MyClass;
}
This gives build error:
error: expected `,`
--> src/lib.rs:13:53
|
13 | #[wasm_bindgen(constructor, js_namespace = mylib.part1)]
| ^
Is it possible to do the import in wasm-bindgen
? Alternative some workaround solution with re-export in js without the 2 module levels (tried, but didn't manage).