Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 2 months ago
JSON representation

A simple boilerplate to get WebAssembly (WASM) code generated by Rust and bundled by Webpack!

Awesome Lists containing this project

README

        

# rust-wasm-webpack 🏎️ [![Build Status](https://travis-ci.org/yamafaktory/rust-wasm-webpack.svg?branch=master)](https://travis-ci.org/yamafaktory/rust-wasm-webpack) [![npm version](https://img.shields.io/npm/v/rust-wasm-webpack.svg?style=flat)](https://www.npmjs.com/package/rust-wasm-webpack) [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](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.