Cargo-component "component dependencies"

⚓ Rust    📅 2025-06-27    👤 surdeus    👁️ 6      

surdeus

Warning

This post was published 44 days ago. The information described in this article may have changed.

I'm trying to figure out how to use cargo-component to build WebAssembly components that call other local components, and the dependency management is kickin' my butt.

The idea is to have a Node application host call a component that can call extensions to said component. See my wasm-playground repo for the project files.

I'm getting the following cargo-component build error when trying to build pluggable:

error: failed to create a target world for package `pluggable` (/home/slanden/Projects/wasm-playground/component_calling_plugins/rust/pluggable/Cargo.toml)

Caused by:
    0: failed to parse local target from directory `/home/slanden/Projects/wasm-playground/component_calling_plugins/rust/pluggable/wit`
    1: name `plugin-interface` is not defined
            --> /home/slanden/Projects/wasm-playground/component_calling_plugins/rust/pluggable/wit/pluggable.wit:6:35
             |
           6 |   get: func(index: u32) -> option<plugin-interface>;

I've tried adding the dependency in Cargo.toml, naming the dependency WIT directory in the pluggable's call to generate!, duplicating the dependency WIT file in a pluggable/wit/deps/ directory... I'm out of ideas.

If interested, the parent directory in the repo has a working example of a Rust host calling plugins I finally got working with help from numerous watchings of Alexandru Radovici's step-by-step talk and an easily digestible article from @benwis (Ben, your site link died since then).

1 post - 1 participant

Read full topic

🏷️ rust_feed