yew/website/docs/getting-started/starter-templates.md
Muhammad Hamza 10b67ea18c
Docusaurus v2 (#1872)
* Docusaurus v2

* i18n

* Fix firebase hosting config
2021-05-26 22:32:07 +02:00

1.4 KiB

title
Starter templates

trunk

wasm-pack

Unlike other tools, wasm-pack forces you to use a lib, not a bin crate, and the entry-point to your program is annotated with a #[wasm_bindgen(start)] attribute.

Your Cargo.toml also should specify that your crate's type is a "cdylib".

[package]
name = "yew-app"
version = "0.1.0"
authors = ["Yew App Developer <name@example.com>"]
edition = "2018"

[lib]
# You should include "rlib" (the default crate type) otherwise your crate can't be used as a Rust library
# which, among other things, breaks unit testing
crate-type = ["rlib", "cdylib"]

[dependencies]
yew = "0.17"
wasm-bindgen = "0.2"

Other templates