mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2024-12-25 11:02:11 +03:00
Add some comments to the hello-world example
This commit is contained in:
parent
e7f7f7864a
commit
98b9bee876
@ -2,8 +2,12 @@
|
||||
|
||||
set -ex
|
||||
|
||||
# Build the `hello_world.wasm` file using Cargo/rustc
|
||||
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
|
||||
# usage you'd use the commented out version below
|
||||
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 .
|
||||
# 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 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");
|
||||
|
||||
js.then(js => {
|
||||
|
Loading…
Reference in New Issue
Block a user