Crates.io | wasm-server-runner |
lib.rs | wasm-server-runner |
version | 0.6.3 |
source | src |
created_at | 2021-12-10 21:16:39.594727 |
updated_at | 2024-02-07 09:15:23.023121 |
description | cargo run for wasm programs |
homepage | |
repository | https://github.com/jakobhellermann/wasm-server-runner/ |
max_upload_size | |
id | 495884 |
size | 80,820 |
Allows you to run programs in the browser using web assembly using a simple cargo run
.
rustup target add wasm32-unknown-unknown
cargo install wasm-server-runner
Add this to your ~/.cargo/config.toml
(not the Cargo.toml
of your project!):
[target.wasm32-unknown-unknown]
runner = "wasm-server-runner"
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.
All configuration options can be specified via environment variables.
Default: 127.0.0.1
Control the address that the server listens on. Set to 0.0.0.0
to allow access from anywhere.
Default: .
Can be used to specify where relative path requests are loaded from.
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>
Default: false
Controls whether https is used.
Default: false
Controls whether the wasm-bindgen output uses module
s or not.