Open kayhhh opened 2 months ago
Hmm, working backwards from a working example, it looks like the following WIT is good:
package component-test:wit-protocol;
interface companies {
resource company-res {
constructor(name: string, max-salary: u32);
get-name: func() -> string;
set-name: func(name: string);
get-max-salary: func() -> u32;
}
}
interface employees {
resource employee-res {
constructor(name: string, min-salary: u32);
get-name: func() -> string;
set-name: func(name: string);
get-min-salary: func() -> u32;
}
}
world resources {
import companies;
export employees;
import log: func(message: string);
}
But if I remove import companies
from resources
, and its associated host implementation, I start getting the same not an Object
error in web.
I have a simple schema:
I am able to use it in native builds, but run into an error with the web build:
Asynchronously instantiate main module TypeError: import object field '[export]example:schema/my-interface' is not an Object
Full code: https://github.com/kayhhh/wasm-bridge-example/tree/5e9165141f47344b75b82644f63f5db0430fcaed
I have gotten some of the test examples in this repo working, but with certain schemas like this I get errors.