添加target:wasm32-unknown-unknown
rustup target add wasm32-unknown-unknown
info: downloading component 'rust-std' for 'wasm32-unknown-unknown'
info: installing component 'rust-std' for 'wasm32-unknown-unknown'
19.0 MiB / 19.0 MiB (100 %) 14.9 MiB/s in 1s ETA: 0s
安装wasm-pack
cargo install wasm-pack
Cargo安装可能会报openssl编译错误,建议直接下载:
https://github.com/rustwasm/wasm-pack
https://rustwasm.github.io/wasm-pack/
安装wasm-bindgen
[INFO]: ⬇️ Installing wasm-bindgen...
Downloaded wasm-bindgen-cli v0.2.84
npm run dev
$ npm run dev
> [email protected] dev F:\worker\worker-rust
> wrangler dev --local
⛅️ wrangler 2.16.0 (update available 2.17.0)
-------------------------------------------------------
Running custom build: cargo install -q worker-build && worker-build --release
[INFO]:
标签:unknown,worker,v1.0,Compiling,wasm,rust
From: https://www.cnblogs.com/develon/p/17352175.html