Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace run-wasm-example.sh with aliased rust crate (xtask) #2346

Merged
merged 1 commit into from
Jan 5, 2022

Conversation

rukai
Copy link
Contributor

@rukai rukai commented Jan 2, 2022

To use the new method simply do:
cargo run-wasm --example cube --features webgl

Advantages over existing solution

  • cross platform
  • 0 external dependencies - the existing solution depends on bash, a webserver and wasm_bindgen.
  • better UX + more robust than anything hacked together with bash/powershell/bat
  • wasm-bindgen-cli version is always in sync with wasm-bindgen version because cargo update updates both of them at the same time thanks to being in the same workspace

Currently uses a git dependency, but i'll release to crates.io when we are happy with the API.

Testing
I ran cargo run-wasm --example cube --features webgl etc for every example on linux.
I confirmed at least the cube example works on mac os and windows.

The documentation at https://github.com/gfx-rs/wgpu/wiki/Running-on-the-Web-with-WebGPU-and-WebGL will need to be changed after merging.

There is a PR in progress to use this same crate for running winit's web examples rust-windowing/winit#2115

@rukai rukai force-pushed the run_wasm branch 5 times, most recently from 832addb to bceab5d Compare January 3, 2022 00:23
.cargo/config Show resolved Hide resolved
Cargo.lock Show resolved Hide resolved
.cargo/config Show resolved Hide resolved
@kvark
Copy link
Member

kvark commented Jan 4, 2022

please rebase

@kvark kvark merged commit b88808b into gfx-rs:master Jan 5, 2022
@rukai
Copy link
Contributor Author

rukai commented Jan 5, 2022

I just noticed a potential problem with using wasm-bindgen-cli-support: rustwasm/wasm-bindgen#2757
If it turns out to be a problem I'll figure out some solution to avoid cargo-run-wasm constantly breaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants