首页 > 解决方案 > Rust 中有类似 nodemon 的东西吗?

问题描述

在 javascriptnodemon中是一个静态文件服务器,它在代码更改时重新加载。我正在使用wasm-packminiserve执行两个命令:

build

wasm-pack build --target web --out-name wasm --out-dir ./static/build

serve

miniserve ./static --index index.html

我希望这两个能够像在 javascript 中一样自动化nodemon

标签: rustwasm-pack

解决方案


使用cargo-watch并通过 shell 命令执行 using -sor --shell flags:

cargo watch -s 'wasm-pack build --target web --out-name wasm --out-dir ./static/build && miniserve ./static --index index.html'

感谢Luxkmdreko的帮助


推荐阅读