-
Book Overview & Buying
-
Table Of Contents
Practical WebAssembly
By :
wasm-bindgen is a complete suite that generates the binding JavaScript file (along with polyfills) for the WebAssembly module. In previous chapters, we saw how wasm-bindgen provides libraries and makes it easy to pass complex objects between JavaScript and WebAssembly. But in the WebAssembly world, it is important to optimize the generated binary for size and performance.
Let's see how we can further optimize the WebAssembly modules:
$ npm init rust-webpack wasm-rust 🦀 Rust + 🕸 WebAssembly + Webpack = ❤
This previous command creates a new Rust and JavaScript-based application with webpack as the bundler.
wasm-rust directory:cd wasm-rust
The Rust source files are present in the src directory and the JavaScript files are available in the js directory. We have webpack configured for running the application...