在 javascript 中
nodemon
是一个静态文件服务器,会在代码更改时重新加载。
我正在使用 wasm-pack
和 miniserve
执行两个命令:
build
wasm-pack build --target web --out-name wasm --out-dir ./static/build
serve
:
miniserve ./static --index index.html
我希望这两个能够自动化,就像在 javascript 中使用
nodemon
一样。
使用 cargo-watch 并传递 shell 命令以使用
-s
或 --shell
标志执行:
cargo watch -s 'wasm-pack build --target web --out-name wasm --out-dir ./static/build && miniserve ./static --index index.html'