diff --git a/substrate/bin/node/cli/browser-demo/README.md b/substrate/bin/node/cli/browser-demo/README.md index 2ff1cc54f5..d5a23485fa 100644 --- a/substrate/bin/node/cli/browser-demo/README.md +++ b/substrate/bin/node/cli/browser-demo/README.md @@ -1,9 +1,6 @@ # How to run this demo ```sh -cargo install wasm-pack # If necessary - -wasm-pack build --target web --out-dir ./browser-demo/pkg --no-typescript --release ./.. -- --no-default-features --features "browser" - -xdg-open index.html +cargo install wasm-bindgen # If necessary +./build.sh ``` diff --git a/substrate/bin/node/cli/browser-demo/build.sh b/substrate/bin/node/cli/browser-demo/build.sh index 059ed9fe42..be52b7a523 100755 --- a/substrate/bin/node/cli/browser-demo/build.sh +++ b/substrate/bin/node/cli/browser-demo/build.sh @@ -1,3 +1,4 @@ #!/usr/bin/env sh -wasm-pack build --target web --out-dir ./browser-demo/pkg --no-typescript --release ./.. -- --no-default-features --features "browser" +cargo +nightly build --release -p node-cli --target wasm32-unknown-unknown --no-default-features --features browser -Z features=itarget +wasm-bindgen ../../../../target/wasm32-unknown-unknown/release/node_cli.wasm --out-dir pkg --target web python -m http.server 8000 diff --git a/substrate/utils/browser/src/lib.rs b/substrate/utils/browser/src/lib.rs index 8bed06eee9..572ebcb464 100644 --- a/substrate/utils/browser/src/lib.rs +++ b/substrate/utils/browser/src/lib.rs @@ -49,7 +49,7 @@ where format!("{} (Browser)", name), "unknown", Default::default(), - &std::env::current_dir().expect("current directory must exist"), + &std::path::PathBuf::new(), ); network.boot_nodes = chain_spec.boot_nodes().to_vec(); network.transport = TransportConfig::Normal {