mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 04:21:21 +00:00
include fetch arg for wasm2es6js
This commit is contained in:
committed by
robert masen
parent
65acc3b692
commit
cbccd2028d
21
examples/hello_world/chrome/build_fetch.sh
Executable file
21
examples/hello_world/chrome/build_fetch.sh
Executable file
@ -0,0 +1,21 @@
|
||||
#!/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
|
||||
# convert the .wasm module to a .js module that embeds the wasm bytecode. To
|
||||
# enable this, use the "--resolve-enxensions .js" flag when starting
|
||||
# webpack-dev-server
|
||||
cargo +nightly run -p wasm-bindgen-cli --bin wasm2es6js -- \
|
||||
--fetch -o hello_world_bg.js hello_world_bg.wasm
|
||||
# wasm2es6js --base64 -o hello_world_bg.js hello_world_bg.wasm
|
||||
|
||||
# And like the directory above this, from here it's the same.
|
||||
npm install
|
||||
#force webpack-dev-server to ignore the .wasm file
|
||||
npm run serve -- --resolve-extensions .js
|
Reference in New Issue
Block a user