fork of https://github.com/rustwasm/wasm-pack for the needs of NextGraph.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
589 B
589 B
Quickstart
- Install
rust
usingrustup
. - Install this tool.
- Run
wasm-pack new hello-wasm
. cd hello-wasm
- Run
wasm-pack build --target web
. - This tool generates files in a
pkg
dir - Import it:
import init, { greet } from "./pkg/hello_wasm.js"
, initialize it:await init()
, and then use it:greet()
- To publish to npm, run
wasm-pack publish
. You may need to login to the registry you want to publish to. You can login usingwasm-pack login
.