Some examples of building wasm use cargo build
(like the examples in the book Programming WebAssembly)
cargo build --release --target=wasm32-unknown-unknown
And others use,
wasm-pack build --target web ....
What's the different between these two methods of building a project?
Wasm-pack is a bigger convenience application that provides more than simply building the Rust code.
Amongst other things wasm-pack provides:
cargo build --target=wasm32-unknown-unknown...
)cargo new
)This tool seeks to be a one-stop shop for building and working with rust- generated WebAssembly that you would like to interop with JavaScript, in the browser or with Node.js. wasm-pack helps you build rust-generated WebAssembly packages that you could publish to the npm registry, or otherwise use alongside any javascript packages in workflows that you already use, such as webpack or greenkeeper. 1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.