• Stars
    star
    138
  • Rank 264,508 (Top 6 %)
  • Language
    Rust
  • License
    Other
  • Created almost 3 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

cargo run for the browser

wasm-server-runner

Allows you to run programs in the browser using web assembly using a simple cargo run.

Usage

Step 1.

rustup target add wasm32-unknown-unknown
cargo install wasm-server-runner

Step 2.

Add this to your ~/.cargo/config.toml (not the Cargo.toml of your project!):

[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"

Step 3.

Run programs in the browser using

cargo run --target wasm32-unknown-unknown
cargo run --target wasm32-unknown-unknown --example example

wasm-server-runner path/to/file.wasm

Example output:

INFO wasm_server_runner: wasm output is 49.79kb large
INFO wasm_server_runner: starting webserver at http://127.0.0.1:1334

The website will reload when the server is restarted and serve files relative to the current directory.

Configuration options

All configuration options can be specified via environment variables.

WASM_SERVER_RUNNER_ADDRESS

Default: 127.0.0.1 Control the address that the server listens on. Set to 0.0.0.0 to allow access from anywhere.

WASM_SERVER_RUNNER_DIRECTORY

Default: .

Can be used to specify where relative path requests are loaded from.

WASM_SERVER_RUNNER_CUSTOM_INDEX_HTML

Default: none

When set, will try to load the custom index.html from that path instead of the default. Can be relative to the directory.

Note: To support both module and non-module style the index.html needs to have specific string that will be replaced at runtime. The body should contain something like

{{ NO_MODULE }}
<script type="module">
    // {{ MODULE }}
</script>
WASM_SERVER_RUNNER_HTTPS

Default: false

Controls whether https is used.

WASM_SERVER_RUNNER_NO_MODULE

Default: false

Controls whether the wasm-bindgen output uses modules or not.

More Repositories

1

bevy-inspector-egui

Inspector plugin for the bevy game engine
Rust
1,125
star
2

bevy_editor_pls

In-App editor tools for bevy applications
Rust
711
star
3

bevy_mod_debugdump

Rust
247
star
4

bevycheck

Rust
84
star
5

bevy_mod_js_scripting

Rust
80
star
6

piechart

a rust crate for drawing fancy pie charts in the terminal
Rust
38
star
7

rupnp

Rust library for the universal plug and play protocol.
Rust
35
star
8

cargo-watt

cargo subcommand for building proc-macro crates with web assembly
Rust
34
star
9

axum_openapi

Rust
31
star
10

sonor

Sonos library for rust
Rust
31
star
11

bevy-contrib-inspector

bevy plugin for starting a webserver to visually edit bevy resources
Rust
21
star
12

bevy_ecs_dynamic

Utilites for working with `bevy_ecs` when not all types are known at compile time
Rust
19
star
13

ssdp-client

An asynchronous Rust library for discovering, notifying and subscribing to devices and services on a network.
Rust
11
star
14

watt-contrib

Rust
8
star
15

ezoauth

Easy to use OAuth2 client for rust
Rust
7
star
16

deno-progressbar

a terminal progressbar for deno
TypeScript
5
star
17

pretty-type-name

Rust
4
star
18

bevy_reflect_ts_type_export

TypeScript
4
star
19

tts-urls

Generate URLs from TTS services, a rust crate
Rust
4
star
20

bevy-asset-distill

Rust
4
star
21

bevy-unofficial-playground-experiments

👀
Rust
4
star
22

Atlas

Render and visualize paths for Celeste TASes
Rust
3
star
23

bevy_shadertoy

Rust
2
star
24

bevy_reflect_fns

Experimentation for reflecting methods using bevy_reflect, to be upstreamed later
Rust
2
star
25

dotfiles

Shell
1
star
26

websocket-async-io

Rust
1
star
27

mc-mod-muffle

A minecraft mod for the fabric modloader which adds a Sound Muffler
Java
1
star
28

trout

TSP solver for routing celeste lobbies while TASing
Rust
1
star
29

CelesteSavefileMerger

Savefile Merger for Celeste
C#
1
star
30

bevy-pipelined-testing

Rust
1
star
31

jakobhellermann.github.io

HTML
1
star
32

celestetools

Rust
1
star