Starter templates

wasm-pack

The important distinction between these templates and using cargo-web is that this approach uses a lib, not a bin crate, and the entry-point to your program is annotated with a #[wasm_bindgen] annotation.

Your Cargo.toml also should specify that your crate’s type is a “cdylib”.

  1. [package]
  2. name = "yew-app"
  3. version = "0.1.0"
  4. authors = ["Yew App Developer "]
  5. edition = "2018"
  6. [lib]
  7. crate-type = ["cdylib"]
  8. [dependencies]
  9. # for web_sys
  10. yew = "0.17"
  11. # or for stdweb
  12. # yew = { version = "0.17", package = "yew-stdweb" }
  13. wasm-bindgen = "0.2"

Other templates