mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-03-31 01:11:06 +00:00
Add some comments to the hello-world example
This commit is contained in:
parent
e7f7f7864a
commit
98b9bee876
@ -2,8 +2,12 @@
|
|||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
# Build the `hello_world.wasm` file using Cargo/rustc
|
||||||
cargo +nightly build --target wasm32-unknown-unknown --release
|
cargo +nightly build --target wasm32-unknown-unknown --release
|
||||||
|
|
||||||
|
# Run the `wasm-bindgen` CLI tool to postprocess the wasm file emitted by the
|
||||||
|
# Rust compiler to emit the JS support glue that's necessary
|
||||||
|
#
|
||||||
# Here we're using the version of the CLI in this repository, but for external
|
# Here we're using the version of the CLI in this repository, but for external
|
||||||
# usage you'd use the commented out version below
|
# usage you'd use the commented out version below
|
||||||
cargo +nightly run --manifest-path ../../crates/wasm-bindgen-cli/Cargo.toml \
|
cargo +nightly run --manifest-path ../../crates/wasm-bindgen-cli/Cargo.toml \
|
||||||
@ -11,5 +15,7 @@ cargo +nightly run --manifest-path ../../crates/wasm-bindgen-cli/Cargo.toml \
|
|||||||
../../target/wasm32-unknown-unknown/release/hello_world.wasm --out-dir .
|
../../target/wasm32-unknown-unknown/release/hello_world.wasm --out-dir .
|
||||||
# wasm-bindgen ../../target/wasm32-unknown-unknown/hello_world.wasm --out-dir .
|
# wasm-bindgen ../../target/wasm32-unknown-unknown/hello_world.wasm --out-dir .
|
||||||
|
|
||||||
|
# Finally, package everything up using Webpack and start a server so we can
|
||||||
|
# browse the result
|
||||||
npm install
|
npm install
|
||||||
npm run serve
|
npm run serve
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
// Note that a dynamic `import` statement here is required due to
|
||||||
|
// webpack/webpack#6615, but in theory `import { greet } from './hello_world';`
|
||||||
|
// will work here one day as well!
|
||||||
const js = import("./hello_world");
|
const js = import("./hello_world");
|
||||||
|
|
||||||
js.then(js => {
|
js.then(js => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user