Updated WebAssembly (markdown)

Hajime Hoshi 2018-08-28 00:27:40 +09:00
parent 7b7914152b
commit 1bdc919404

@ -1,4 +1,4 @@
~The easiest way is to use [WasmServe](https://github.com/hajimehoshi/wasmserve) with the latest Go.~ WasmServe doesn't work well with modules. Stay tuned!
The easiest way is to use [WasmServe](https://github.com/hajimehoshi/wasmserve) with the latest Go.
This article introduces a regular way to build an Ebiten app as a WebAssembly port.
@ -7,13 +7,24 @@ This article introduces a regular way to build an Ebiten app as a WebAssembly po
* Go 1.11
* Ebiten master branch (1.8.0-alpha.0.XXX) / 2.0.0-alpha
# Compile your game
# 1. WasmServe
```sh
cd yourgame
wasmserve
```
Then access `http://localhost:8080/`.
# 2. Regular
## Compile your game
```sh
GOOS=js GOARCH=wasm go build -o yourgame.wasm github.com/yourname/yourgame
```
# Copy `wasm_exec.js` to execute the Wasm binary
## Copy `wasm_exec.js` to execute the Wasm binary
```sh
cp $GOROOT/misc/wasm/wasm_exec.js .