Add wasm web build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

author
Marijn Besseling <njirambem@gmail.com> · 2026-10-24 07:55 UTC
commit
2ca3c77f8aadc58d7a55de67813652b19fb1b5f5
parent
7cf33bf6f2
tree
browse at this commit

3 files changed +40 -0

.claude/launch.json added +11 -0
scripts/build-web.sh added +11 -0
web/index.html added +18 -0

.claude/launch.json +11 -0

@@ -0,0 +1,11 @@
1 +{
2 + "version": "0.0.1",
3 + "configurations": [
4 + {
5 + "name": "web",
6 + "runtimeExecutable": "python3",
7 + "runtimeArgs": ["-m", "http.server", "8080", "--directory", "target/web"],
8 + "port": 8080
9 + }
10 + ]
11 +}

scripts/build-web.sh +11 -0

@@ -0,0 +1,11 @@
1 +#!/usr/bin/env bash
2 +set -euo pipefail
3 +cd "$(dirname "$0")/.."
4 +profile="${1:-wasm-release}"
5 +cargo build --target wasm32-unknown-unknown --profile "$profile"
6 +out=target/web
7 +mkdir -p "$out"
8 +cp web/index.html "$out/"
9 +wasm-bindgen --no-typescript --target web --out-dir "$out" --out-name simulator \
10 + "target/wasm32-unknown-unknown/$profile/simulator.wasm"
11 +echo "built $out"

web/index.html +18 -0

@@ -0,0 +1,18 @@
1 +<!doctype html>
2 +<html lang="en">
3 +<head>
4 + <meta charset="utf-8">
5 + <title>Simulator</title>
6 + <style>
7 + html, body { margin: 0; height: 100%; background: #141419; overflow: hidden; }
8 + canvas { display: block; width: 100%; height: 100%; outline: none; }
9 + </style>
10 +</head>
11 +<body>
12 + <canvas id="bevy" tabindex="0" oncontextmenu="return false"></canvas>
13 + <script type="module">
14 + import init from './simulator.js';
15 + init();
16 + </script>
17 +</body>
18 +</html>