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
|
2018-04-23 09:04:30 -05:00
|
|
|
# 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 -- \
|
2018-04-23 09:04:30 -05:00
|
|
|
--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
|
2018-04-23 09:04:30 -05:00
|
|
|
|
|
|
|
# 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
|