57 releases (14 breaking)

new 0.208.1 May 20, 2024
0.207.0 May 7, 2024
0.202.0 Mar 26, 2024
0.4.16 Nov 29, 2023
0.0.0 Jun 28, 2022

#1375 in WebAssembly

Download history 252/week @ 2024-01-29 227/week @ 2024-02-05 493/week @ 2024-02-12 320/week @ 2024-02-19 503/week @ 2024-02-26 552/week @ 2024-03-04 761/week @ 2024-03-11 1021/week @ 2024-03-18 954/week @ 2024-03-25 1161/week @ 2024-04-01 792/week @ 2024-04-08 1282/week @ 2024-04-15 2050/week @ 2024-04-22 887/week @ 2024-04-29 1664/week @ 2024-05-06 1454/week @ 2024-05-13

6,113 downloads per month
Used in 15 crates (4 directly)

Apache-2.0 WITH LLVM-exception

34K SLoC


A Bytecode Alliance project

A WebAssembly component composing library.

Crates.io version Download docs.rs docs


IMPORTANT: wasm-compose has been been deprecated in favor of wac.

wasm-compose is a library for composing WebAssembly components from other WebAssembly components.

It is made available as the compose subcommand of wasm-tools.


To compose a component, run the compose command:

wasm-tools compose -o composed.wasm component.wasm

This will automatically search for dependencies at the same location as the input component, component.wasm, and create a composed component named composed.wasm.

Any unresolved dependencies will remain as imports in the composed component.


See configuring wasm-compose for more information on authoring configuration files.

How it works

wasm-compose starts with the input component and then processes each of the component's instance imports.

For each instance import, wasm-compose will consult its configuration to determine how to locate a dependency with the same name as the import.

If the dependency is not specified in the configuration, wasm-compose will search the configured search paths for a matching component file.

If a component to satisfy the dependency cannot be found, it will remain as an instance import in the composed component; at least one dependency must be satisfied for the component to be composed.

wasm-compose then repeats this process for all of the transitive imports of dependent components that have been found.

The composed component will, by default, define the transitive component dependencies directly in the composed component; it will then instantiate the dependencies in a topological order.

Finally the input component is instantiated and all of its exports are then exported from the composed component.


See the example directory for a complete example of composing WebAssembly components together.


This project is licensed under the Apache 2.0 license with the LLVM exception. See LICENSE for more details.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.


~144K SLoC