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.
 
 
wasm-pack/docs/src/tutorials/npm-browser-packages/building-your-project.md

618 B

Building your project

We've written our code so now we need to build it.

We are writing a crate that should be used in the browser, so we run this in our terminal:

$ wasm-pack build

If you were writing a package that should be used in Node.js (with CommonJS modules, e.g. require), you would run this in your terminal:

$ wasm-pack build --target nodejs

This command when run does a few things:

  1. It'll compile your code to wasm if you haven't already
  2. It'll generate a pkg folder with the wasm file, a JS wrapper file around the wasm, your README, and a package.json file.