21 lines
776 B
Bash
Raw Normal View History

2018-04-20 21:13:28 -05:00
#!/bin/sh
set -ex
# This is the same as the directory above this.
cargo +nightly build --target wasm32-unknown-unknown
cargo +nightly run -p wasm-bindgen-cli --bin wasm-bindgen -- \
../../../target/wasm32-unknown-unknown/debug/hello_world.wasm --out-dir .
# To avoid a bug occurring when webpack, wasm, and Chrome are used together, we
# create a .js module that will download the .wasm module via fetch.
2018-04-20 21:13:28 -05:00
cargo +nightly run -p wasm-bindgen-cli --bin wasm2es6js -- \
--fetch ./hello_world_bg.wasm -o hello_world_bg.js hello_world_bg.wasm
2018-04-20 21:13:28 -05:00
# And like the directory above this, from here it's the same.
npm install
# since we kept the same name for the .js module, we need
# to force webpack to ignore any other file extensions
2018-04-20 21:13:28 -05:00
npm run serve -- --resolve-extensions .js