From d86bd898cb6b64d2f29a44939f63768b0603f141 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Thu, 11 Feb 2021 01:19:32 +0900 Subject: [PATCH] Prepare JavaScript on build process --- build.rs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/build.rs b/build.rs index e56fc559..d9ba2568 100644 --- a/build.rs +++ b/build.rs @@ -48,19 +48,13 @@ fn main() { create_dir_all(&Path::new("static").join("media")).expect("Couldn't init media directory"); let cache_id = &compute_static_hash()[..8]; - println!("cargo:rerun-if-changed=target/deploy/plume-front.wasm"); - copy("target/deploy/plume-front.wasm", "static/plume-front.wasm") - .and_then(|_| read_to_string("target/deploy/plume-front.js")) - .and_then(|js| { - write( - "static/plume-front.js", - js.replace( - "\"plume-front.wasm\"", - &format!("\"/static/cached/{}/plume-front.wasm\"", cache_id), - ), - ) - }) - .ok(); + println!("cargo:rerun-if-changed=plume-front/pkg/plume_front_bg.wasm"); + copy( + "plume-front/pkg/plume_front_bg.wasm", + "static/plume_front_bg.wasm", + ) + .and_then(|_| copy("plume-front/pkg/plume_front.js", "static/plume_front.js")) + .ok(); println!("cargo:rustc-env=CACHE_ID={}", cache_id) }