diff --git a/packages/backend-rs/Cargo.toml b/packages/backend-rs/Cargo.toml index a9bcb3777f..8dd935c1a0 100644 --- a/packages/backend-rs/Cargo.toml +++ b/packages/backend-rs/Cargo.toml @@ -6,7 +6,7 @@ rust-version = "1.74" [features] default = [] -napi = ["dep:napi", "dep:napi-derive"] +napi = ["dep:napi", "dep:napi-derive", "dep:napi-build"] [lib] crate-type = ["cdylib", "lib"] @@ -53,4 +53,4 @@ pretty_assertions = { workspace = true, features = ["std"] } tokio-test = { workspace = true } [build-dependencies] -napi-build = { workspace = true } +napi-build = { workspace = true, optional = true } diff --git a/packages/backend-rs/build.rs b/packages/backend-rs/build.rs index 9e5e97713c..71dd87aa16 100644 --- a/packages/backend-rs/build.rs +++ b/packages/backend-rs/build.rs @@ -1,9 +1,8 @@ -extern crate napi_build; - fn main() { // watch the version in the project root package.json println!("cargo:rerun-if-changed=../../package.json"); // napi + #[cfg(feature = "napi")] napi_build::setup(); }