From 2d61612bc9d64a727036ed1e88c4a63ea78c9269 Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Sat, 16 May 2026 21:21:04 +0900 Subject: [PATCH] fix(bindgen): avoid assuming WebAssembly global is present For some downstream consumers of `js-component-bindgen` which use `wizer` (like `componentize-js`), the `WebAssembly` global is not present. This PR removes adds a check for the global before use --- crates/js-component-bindgen/src/intrinsics/p3/async_task.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/js-component-bindgen/src/intrinsics/p3/async_task.rs b/crates/js-component-bindgen/src/intrinsics/p3/async_task.rs index 5ae248730..ec428db52 100644 --- a/crates/js-component-bindgen/src/intrinsics/p3/async_task.rs +++ b/crates/js-component-bindgen/src/intrinsics/p3/async_task.rs @@ -336,7 +336,7 @@ impl AsyncTaskIntrinsic { uwriteln!( output, r#" - const {var_name} = new WebAssembly.Global({{ value: 'i32', mutable: true }}, 0); + const {var_name} = globalThis.WebAssembly ? new globalThis.WebAssembly.Global({{ value: 'i32', mutable: true }}, 0) : false; "# ); }