Function download_prebuilt_or_cargo_install() checks if there is a globally installed wasm-bindgen using which before doing any downloads. But if wasm-bindgen is installed by wasm-pack using cargo install which is the last resort, it will still try to download it from github.
This may cause the following issues:
- There could be two copies of wasm-bindgen of the same version, one from
cargo install, the other from github.
- In regions where github connection is slow is easy to break while crates.io connection is normal,
wasm-pack could be stuck in the download_prebuilt() for a long time due to the slow connection every time wasm-pack build is invoked, even though a wasm-bindgen binary is already installed via cargo install. This however can be resolved using --mode no-install.
A simple solution is just moving the checkcing-if-installed part of cargo_install() function before calling download_prebuilt(). But a better way to do this may be checking both sources before doing any downloads.
Function
download_prebuilt_or_cargo_install()checks if there is a globally installedwasm-bindgenusingwhichbefore doing any downloads. But ifwasm-bindgenis installed bywasm-packusingcargo installwhich is the last resort, it will still try to download it from github.This may cause the following issues:
cargo install, the other from github.wasm-packcould be stuck in thedownload_prebuilt()for a long time due to the slow connection every timewasm-pack buildis invoked, even though awasm-bindgenbinary is already installed viacargo install. This however can be resolved using--mode no-install.A simple solution is just moving the checkcing-if-installed part of
cargo_install()function before callingdownload_prebuilt(). But a better way to do this may be checking both sources before doing any downloads.