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

Hands On with Adobe Document Generation API

Debugging My Way Out Performance Issues in Azure SQL Database

COTI to Partner with FluidTokens to Use Djed as the Stablecoin for their Lending and Borrowing…

Weekly update from Grand Time (October 25 — October 31, 2021)

Agile project management in our team at UX Gorilla

CODING IS TOUGH OR YOU’RE NOT JUST TOUGH ENOUGH?

Scaleup Architect — Edition #12

How to Create a CSS Button With CSS Animation

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.

Calling C functions from Deno: Part 2 — Pass buffers

Writing a kernel driver with Rust.

Rust programing for beginners [part three]