Skip to content

Commit 630f174

Browse files
committed
chore: add build.rs for rest napi binding crate
1 parent 3f70499 commit 630f174

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Diff for: Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: crates/rspack_binding_values/Cargo.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ license = "MIT"
55
name = "rspack_binding_values"
66
repository = "https://github.com/web-infra-dev/rspack"
77
version = "0.2.0"
8-
8+
[lib]
9+
crate-type = ["cdylib", "rlib"]
910
[features]
1011
plugin = ["rspack_loader_swc/plugin"]
1112

@@ -86,3 +87,6 @@ rspack_plugin_wasm = { workspace = true }
8687
rspack_plugin_web_worker_template = { workspace = true }
8788
rspack_plugin_worker = { workspace = true }
8889
rspack_tracing = { workspace = true }
90+
91+
[build-dependencies]
92+
napi-build = { workspace = true }

Diff for: crates/rspack_binding_values/build.rs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fn main() {
2+
napi_build::setup();
3+
4+
// Rebuild binding options if and only if it's built for crate `node_binding`
5+
if std::env::var("OUT_DIR")
6+
.expect("should exist")
7+
.contains("node_binding")
8+
{
9+
println!("cargo:rerun-if-changed=../node_binding");
10+
}
11+
}

0 commit comments

Comments
 (0)