diff --git a/src/wasm/webcompiler/Cargo.toml b/src/wasm/webcompiler/Cargo.toml index ee50753..c4f0646 100644 --- a/src/wasm/webcompiler/Cargo.toml +++ b/src/wasm/webcompiler/Cargo.toml @@ -10,9 +10,10 @@ crate-type = ["cdylib"] [dependencies] wasm-bindgen = "0.2.92" -shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "af544ac79eea4498ef4563acfb7e8dd14ec5c84e" } +shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "a0a27cda96e1922b019b216961c39f7ef7991d22" } serde = "1.0" serde-wasm-bindgen = "0.6.5" anyhow = "1.0.86" zip = { version = "2.1.3", default-features = false, features = ["deflate"] } base64 = "0.22.1" +console_error_panic_hook = "0.1.7" diff --git a/src/wasm/webcompiler/src/lib.rs b/src/wasm/webcompiler/src/lib.rs index 18aa9eb..1416dc6 100644 --- a/src/wasm/webcompiler/src/lib.rs +++ b/src/wasm/webcompiler/src/lib.rs @@ -29,6 +29,8 @@ extern "C" { /// Compiles the given directory into datapack files. #[wasm_bindgen] pub fn compile(root_dir: JsValue) -> JsValue { + console_error_panic_hook::set_once(); + let root_dir = VFolder::from(serde_wasm_bindgen::from_value::(root_dir).unwrap()); log("Compiling..."); @@ -43,6 +45,8 @@ pub fn compile(root_dir: JsValue) -> JsValue { /// Returns a base64 encoded zip file containing the compiled datapack. #[wasm_bindgen(js_name = compileZip)] pub fn compile_zip(root_dir: JsValue) -> Option { + console_error_panic_hook::set_once(); + let root_dir = VFolder::from(serde_wasm_bindgen::from_value::(root_dir).unwrap()); let datapack = _compile(&root_dir).ok()?;