diff --git a/Cargo.lock b/Cargo.lock index 5e907f2a4a9..490c4ce90e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1617,9 +1617,9 @@ dependencies = [ [[package]] name = "napi" -version = "2.15.4" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e0dc78e0524286630914db66e31bad70160e379705a9ce92e0161ce2389d89" +checksum = "54a63d0570e4c3e0daf7a8d380563610e159f538e20448d6c911337246f40e84" dependencies = [ "anyhow", "bitflags 2.4.2", @@ -1640,9 +1640,9 @@ checksum = "2f9130fccc5f763cf2069b34a089a18f0d0883c66aceb81f2fad541a3d823c43" [[package]] name = "napi-derive" -version = "2.15.3" +version = "2.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56bd9f0bd84c1f138c5cb22bbf394f75d796b24dad689599ca94cf94e61cc21" +checksum = "05bb7c37e3c1dda9312fdbe4a9fc7507fca72288ba154ec093e2d49114e727ce" dependencies = [ "cfg-if", "convert_case", @@ -1654,9 +1654,9 @@ dependencies = [ [[package]] name = "napi-derive-backend" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d03b8f403a37007cad225039fc0323b961bb40d697eea744140920ebb689ff1d" +checksum = "f785a8b8d7b83e925f5aa6d2ae3c159d17fe137ac368dc185bef410e7acdaeb4" dependencies = [ "convert_case", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 7bbfa1fc403..cc2d626c42c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,9 +54,9 @@ ustr = { package = "ustr-fxhash", version = "1.0.0" } xxhash-rust = { version = "0.8.10" } # Pinned -napi = { version = "=2.15.4" } +napi = { version = "=2.16.0" } napi-build = { version = "=2.1.2" } -napi-derive = { version = "=2.15.3" } +napi-derive = { version = "=2.16.0" } napi-sys = { version = "=2.3.0" } tikv-jemallocator = { version = "=0.5.4", features = ["disable_initial_exec_tls"] } diff --git a/crates/rspack_napi_shared/src/utils.rs b/crates/rspack_napi_shared/src/utils.rs index 42015cfb17e..c4180d7d355 100644 --- a/crates/rspack_napi_shared/src/utils.rs +++ b/crates/rspack_napi_shared/src/utils.rs @@ -14,7 +14,8 @@ unsafe fn object_prototype_to_string_call( let env = Env::from(raw_env); let s: JsString = env .get_global()? - .get_named_property::("Object")? + // `Object` is a function, but we want to use it as an JSObject. + .get_named_property_unchecked::("Object")? .get_named_property::("prototype")? .get_named_property::("toString")? .call_without_args(Some(