wasm-pack
wasm-pack copied to clipboard
cargo install wasm-opt if not present
I ran into https://github.com/rustwasm/wasm-pack/issues/1280. This issue is closed but this still seems to be a problem.
I ran into the following error:
$ wasm-pack build --target web --out-name wasm --out-dir ./static
[INFO]: 🎯 Checking for the Wasm target...
[INFO]: 🌀 Compiling to Wasm...
Finished `release` profile [optimized] target(s) in 0.01s
[INFO]: ⬇️ Installing wasm-bindgen...
Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-arm64-macos.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_117/binaryen-version_117-arm64-macos.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
The original code was written 5 years ago and I assume back then it was not possible to cargo install wasm-opt. Now it is and this PR fixes the referenced issue.
PS: If you manually run cargo install wasm-opt before running wasm-pack [...] you do not have this problem but this PR prevents this step.
Make sure these boxes are checked! 📦✅
- [x] You have the latest version of
rustfmtinstalled
$ rustup component add rustfmt
- [x] You ran
cargo fmton the code base before submitting - [x] You reference which issue is being closed in the PR text
✨✨ 😄 Thanks so much for contributing to wasm-pack! 😄 ✨✨