You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a simple Webpack loader that shells out to cargo to build a Rust project targeting either asm.js or
WebAssembly. See this post for
more details on using Rust to target the web.
Make sure you have the cargo, rustc, and emsdk binaries somewhere in your PATH.
When targeting WebAssembly, the loader will emit two additional files: one .wasm and one .js. You must specify
the outName option to tell the loader how to name these files, and you'll need to load them info your HTML page in
order to run the code. Check out the configuration and example sections below for more details.
Configuration
The following options can be added to the Webpack loader query:
Name
Description
Required
Default
release
Whether or not to pass the --release flag to cargo
false
false
target
The output target of the cargo build. Available options are asmjs and wasm.
false
asmjs
outName
The name of the output file for the wasm and js files when targeting wasm
Only when target is wasm
none
Example
Check out the example directory for a simple Hello World example targeting both asm.js and WebAssembly.