Quickstart

  1. Install rust using rustup.
  2. Install this tool.
  3. Run wasm-pack new hello-wasm.
  4. cd hello-wasm
  5. Run wasm-pack build --target web.
  6. This tool generates files in a pkg dir
  7. Import it: import init, { greet } from "./pkg/hello_wasm.js", initialize it: await init(), and then use it: greet()
  8. To publish to npm, run wasm-pack publish. You may need to login to the registry you want to publish to. You can login using wasm-pack login.