https://github.com/yamafaktory/rust-wasm-webpack
A simple boilerplate to get WebAssembly (WASM) code generated by Rust and bundled by Webpack!
https://github.com/yamafaktory/rust-wasm-webpack
rust rustlang wasm webassembly webpack
Last synced: 9 months ago
JSON representation
A simple boilerplate to get WebAssembly (WASM) code generated by Rust and bundled by Webpack!
- Host: GitHub
- URL: https://github.com/yamafaktory/rust-wasm-webpack
- Owner: yamafaktory
- License: mit
- Archived: true
- Created: 2017-12-10T08:39:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T16:51:38.000Z (over 6 years ago)
- Last Synced: 2025-01-15T21:26:52.177Z (over 1 year ago)
- Topics: rust, rustlang, wasm, webassembly, webpack
- Language: JavaScript
- Homepage:
- Size: 1.07 MB
- Stars: 88
- Watchers: 8
- Forks: 4
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-wasm-webpack 🏎️ [](https://travis-ci.org/yamafaktory/rust-wasm-webpack) [](https://www.npmjs.com/package/rust-wasm-webpack) [](http://standardjs.com/)
A simple boilerplate to get WebAssembly (WASM) code generated by Rust and bundled by Webpack!
This project now uses the awesome [rust-native-wasm-loader](https://github.com/dflemstr/rust-native-wasm-loader) 🚀.
## Prerequisite
To get started, we need to install **rustup**, the Rust toolchain installer:
```sh
curl https://sh.rustup.rs -sSf | sh
```
Please refer to its [documentation](https://github.com/rust-lang-nursery/rustup.rs).
## Usage
### Setup
First, install the necessary NodeJS dependencies:
```sh
yarn
```
The next step will update to the latest Rust nightly, add the `wasm32-unknown-unknown` toolchain and install [wasm-gc](https://github.com/alexcrichton/wasm-gc) from *git*. The latter is a small command to clean a wasm module and remove all unneeded exports, imports, functions, etc.
```sh
yarn setup
```
### Build
*You can skip this step and directly launch the dev server.*
```sh
yarn build
```
### Launch the dev server
```sh
yarn start
```
Go to http://localhost:9000/ and enjoy!
## License
Released under the [MIT license](https://opensource.org/licenses/MIT) by Davy Duperron.