280: Add required wasm-bindgen patches to readme r=grovesNL a=rukai

Fixes https://github.com/gfx-rs/wgpu-rs/issues/279

Co-authored-by: Rukai <rubickent@gmail.com>
This commit is contained in:
bors[bot] 2020-04-25 03:03:56 +00:00 committed by GitHub
commit 455f5cb224
2 changed files with 10 additions and 2 deletions

View File

@ -72,6 +72,7 @@ test = true
#gfx-backend-dx11 = { version = "0.5.0", path = "../gfx/src/backend/dx11" }
#gfx-descriptor = { version = "0.1.0", path = "../gfx-extras/gfx-descriptor" }
#gfx-memory = { version = "0.1.0", path = "../gfx-extras/gfx-memory" }
# Make sure to remove these patches from the README.md when they are are no longer needed
wasm-bindgen = { git = "https://github.com/rustwasm/wasm-bindgen" }
wasm-bindgen-futures = { git = "https://github.com/rustwasm/wasm-bindgen" }
web-sys = { git = "https://github.com/rustwasm/wasm-bindgen" }

View File

@ -55,8 +55,6 @@ Create an `index.html` file into `target/generated` directory and add the follow
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google" content="notranslate">
<title>hello-triangle</title>
</head>
<body>
<script type="module">
@ -69,6 +67,15 @@ Create an `index.html` file into `target/generated` directory and add the follow
Now run a web server locally inside the `target/generated` directory to see the `hello-triangle` in the browser.
If you want to adapt the above to run your own crate on the web you will also need to add the following to your Cargo.toml:
```toml
[patch.crates-io]
wasm-bindgen = { git = "https://github.com/rustwasm/wasm-bindgen" }
wasm-bindgen-futures = { git = "https://github.com/rustwasm/wasm-bindgen" }
web-sys = { git = "https://github.com/rustwasm/wasm-bindgen" }
js-sys = { git = "https://github.com/rustwasm/wasm-bindgen" }
```
## Friends
Shout out to the following projects that work best with wgpu-rs: