Get Started with Rust, WebAssembly, and Webpack

  • webpack 3.0.0
  • cargo 0.19.0
  • emcc 1.37.13

What you will need

Install the Emscripten Rust compiler

 rustup target add wasm32-unknown-emscripten
brew install cmake                  # MacOS, brew
sudo port install cmake # MacOS, MacPorts
sudo apt-get install cmake # Debian Linux
 cd ~
wget https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz
tar -xvf emsdk-portable.tar.gz
cd emsdk-portable
./emsdk update
./emsdk install sdk-incoming-64bit
https://xkcd.com/303/
~/emsdk-portable
~/emsdk-portable/clang/fastcomp/build_incoming_64/bin
~/emsdk-portable/emscripten/incoming

Compile and load Rust with Webpack

cargo new tutorial --bin --vcs none
cd tutorial
npm init # You can just hit enter for every option
npm install --save-dev webpack http-server rust-wasm-loader
npm run compile
npm run serve
It’s happening!

Resources

 by the author.

--

--

--

programmer || ❤️ the open web, functional programming, & game dev ❤️

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Beautiful interactions

Why I’m Still All In On Andela

The Summer Jam LAND Sale — Wave 4

Coding Stories: Demystifying Drops

GSoC with Libmicrovmi

Real-Time Kafka / MapR Streams Data Ingestion into HBase / MapR-DB via PySpark

What has a 10x software developer ever done for us?

Deprecate Fragment’s onActivityCreated() on Android

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ian J Sikes

Ian J Sikes

programmer || ❤️ the open web, functional programming, & game dev ❤️

More from Medium

Using Rust from within Node.js. Or extending Node.js via N-API using NAPI-RS.

3D Boids in Rust

360° IT Check #38 — Types In JavaScript, Rust at 1Password, And More!

Run JavaScript Code One Magnitude Faster Using WebAssembly