mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-12 20:41:24 +00:00
Convert all examples to using wasm-pack
This commit migrates all our examples to using `wasm-pack build` to compile their code and run `wasm-bindgen`. This should make it a bit easier to understand the examples as there's less to follow during the build step. Webpack projects are all using `@wasm-tool/wasm-pack-plugin` as well so the build step is simple `npm run serve`. Other examples which retain `build.sh` are just using `wasm-pack build` now
This commit is contained in:
@ -3,16 +3,13 @@
|
||||
set -ex
|
||||
|
||||
# Compile our wasm module and run `wasm-bindgen`
|
||||
cargo build --target wasm32-unknown-unknown --release
|
||||
cargo run --manifest-path ../../crates/cli/Cargo.toml \
|
||||
--bin wasm-bindgen -- \
|
||||
../../target/wasm32-unknown-unknown/release/wasm2js.wasm --out-dir .
|
||||
wasm-pack build
|
||||
|
||||
# Run the `wasm2js` tool from `binaryen`
|
||||
wasm2js wasm2js_bg.wasm -o wasm2js_bg.js
|
||||
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.js
|
||||
|
||||
# Move our original wasm out of the way to avoid cofusing Webpack.
|
||||
mv wasm2js_bg.wasm wasm2js_bg.bak.wasm
|
||||
mv pkg/wasm2js_bg.wasm pkg/wasm2js_bg.bak.wasm
|
||||
|
||||
npm install
|
||||
npm run serve
|
||||
|
Reference in New Issue
Block a user