Iterate
This section describes how you can iteratively build and test your component functionality.
wash dev
wash dev
starts a local wasmCloud host (if you don't already have one started), builds your component,
and automatically registers your component with the host. It will also watch your component source code for
changes, recompile, and update the component in the host.
This is a great way to get started with wasmCloud development, and we recommend it for all new components.
Currently, wash dev
only will start the component, so you'll have to follow the steps in the running
the component section to start the providers your component needs. We hope to automate as much of
that away in the future.
Before running wash dev
, you'll need to enable experimental mode for wash:
export WASH_EXPERIMENTAL=true
Alternatively, you can run the command with the --experimental
flag:
wash dev --experimental
The output should look like the following:
⚠️ No running wasmcloud host detected (PID file missing), starting a new host...
🔧 Successfully started wasmCloud instance
⏳ Waiting for host to become reachable...
✅ Found single host w/ ID [NANYXG3E44U4PNBHROWR3KE6V6YK3AP6IJTZVOKH47MGHQJM7ICHG6HK]
🚧 Starting project build
✅ successfully built project at [/Users/wasmcloud/hello/build/http-hello-world_s.wasm]
👀 watching for file changes (press Ctrl+c to stop)...
This will watch your project's files and, whenever there's a change, recompile and update the component in the host. Try iterating through a few changes in the Add Features section to see how it works.
If a component is handling a message when an update occurs, the host waits for the message handler to complete, then swaps in the newer WebAssembly component before the next message is processed.