From 2980c62f9f866c3e3e43fddcf13e8add1542036e Mon Sep 17 00:00:00 2001 From: David O'Connor Date: Tue, 13 Aug 2019 09:00:19 +0400 Subject: [PATCH] Modified to use newer wasm-bindgen flow and web target --- Cargo.toml | 2 +- Makefile.toml | 11 ++++++++--- index.html | 28 +++++++++------------------- src/lib.rs | 2 +- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 65d19dc..283d850 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,6 @@ futures = "^0.1.26" wasm-bindgen-test = "0.2.45" # NOTE: keep in sync with wasm-bindgen version -[profile.release] +[profile.release] # Attempts to minimize file size lto = true opt-level = 'z' \ No newline at end of file diff --git a/Makefile.toml b/Makefile.toml index c5708ef..7c44bbf 100755 --- a/Makefile.toml +++ b/Makefile.toml @@ -20,19 +20,24 @@ args = ["build", "--release"] description = "Build with wasm-pack" install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } command = "wasm-pack" -args = ["build", "--target", "no-modules", "--out-name", "package", "--dev"] +args = ["build", "--target", "web", "--out-name", "package", "--dev"] [tasks.create_wasm_release] description = "Build with wasm-pack" install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } command = "wasm-pack" -args = ["build", "--target", "no-modules", "--out-name", "package"] +args = ["build", "--target", "web", "--out-name", "package"] [tasks.build] description = "Build, and create wasms" workspace = false dependencies = ["compile", "create_wasm"] +[tasks.build_release] +description = "Build, and create wasms, with the release flag" +workspace = false +dependencies = ["compile_release", "create_wasm_release"] + [tasks.watch] description = "Build, create wasms, and watch/recompile files for changes" workspace = false @@ -86,4 +91,4 @@ args = ["test", "--headless", "--${@}"] [tasks.test_h_release] extend = "test_h" description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" -args = ["test", "--headless", "--${@}", "--release"] \ No newline at end of file +args = ["test", "--headless", "--${@}", "--release"] diff --git a/index.html b/index.html index 860dc2d..b7a5d50 100755 --- a/index.html +++ b/index.html @@ -10,25 +10,15 @@ A Title - - -
+ - + +
+ - - - + diff --git a/src/lib.rs b/src/lib.rs index 412da65..ae1ae0b 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,7 +41,7 @@ fn view(model: &Model) -> impl View { ] } -#[wasm_bindgen] +#[wasm_bindgen(start)] pub fn render() { seed::App::build(|_, _| Model::default(), update, view) .finish()