Hey there -- I am curious about how to replace cargo wasi run with cargo-component or something else?
You can use cargo run --target wasm32-wasip2 for this and also setting CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime
This is super helpful! Can CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime be set as a default in Cargo.toml/ .cargo/config.toml?
yeah there it'd be:
[target.wasm32-wasip2]
runner = 'wasmtime'
er, that's in .cargo/config.toml, not Cargo.toml
tysm!
Is there an explanation of what CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtimechanges exactly as I have been building my components without it and have not noticed any issues?
The runner is an executable that will be used by cargo when doing cargo run, cargo test or cargo bench to run the compiled executable. Without setting the runner to wasmtime these things would fail as your OS doesn't know how to execute wasm.
That makes sense, all I was doing was building anyways.
Last updated: Dec 06 2025 at 05:03 UTC