Wasmtime Modular Tish Example
Multiple Tish modules that depend on each other via import/export, each compilable to a separate WASI .wasm binary, runnable via wasmtime.
Prerequisites
- Tish CLI with WASI support: build from the tish repo root with
cargo build --release -p tish(thetishcrate includes thewasitarget). If you see "Unknown target: wasi", you're using an older or different tish binary; run./build.shfrom this directory so it uses the workspace tish viacargo run -p tish. rustup target add wasm32-wasip1- wasmtime installed
Build
From the tish workspace root:
./examples/wasmtime-modules/build.shOr from this directory:
./build.shOutput: dist/main.wasm, dist/math.wasm, dist/greet.wasm
Run
Merged program (main imports math + greet; compiled as one binary):
wasmtime dist/main.wasmStandalone modules:
wasmtime dist/math.wasm
wasmtime dist/greet.wasmHow It Works
- Modular sources:
math.tishandgreet.tishexport functions;main.tishimports them. - Separate binaries: Each module is compiled as its own entry point, producing a distinct
.wasm. - Merge at compile time: When building
main.wasm, Tish resolves and inlines imports frommath.tishandgreet.tishinto a single program. There is no runtime module loading. - Tish WASM model: Each
.wasmis the Tish VM with embedded bytecode. Tish does not emit user-exported functions for wasmtime's Linker; linking is conceptual (separate build artifacts) rather than runtime (WASM imports between modules).