Hi folks.
I'm exploring the capability of the component model and existing tools.
In this repo, I want to export a simple function bar()
from the "secondary" component. And let the "primary" component to import that function.
The code in my repo now doesn't work.
$ cargo build -p primary --target wasm32-unknown-unknown
error: package not found
--> /<project-root>/../wit/primary.wit:4:10
|
4 | import example:secondary/foo;
It seems that the "wit" files contains some error. How can I make "primary.wit" be able to import an interface in "secondary.wit"?
$ cargo build -p secondary --target wasm32-unknown-unknown
error: expected `exports` map to contain key `example:secondary/foo`
It seems that I didn't use the wit_bindgen::generate!()
macro correctly. But the doc of this proc-macro is not helpful.
Could you help me to fix the errors?
Or are there any related demo projects/examples? I haven't find any examples involve multiple "wit" files that cross-referencing.
I managed to fix both errors.
Linwei Shang has marked this topic as resolved.
Last updated: Dec 23 2024 at 12:05 UTC