Skip to main content

build

Function build 

Source
pub fn build(config: BuildConfig)
Expand description

Transpile JS → Zig, build the Zig static library, and emit cargo:rustc-link-* directives for the linker.

Call this from your build.rs. On the first build after a clean checkout this does the heavy lifting (transpile + zig build). On subsequent builds it detects the up-to-date cache and is a near-no-op.

ⓘ
fn main() {
    js2rust_bridge::build(js2rust_bridge::BuildConfig {
        name: "main".into(),
        js_file: "js_src/main.js".into(),
        additional_js_files: vec![],
        host_functions: Default::default(),
        force_rebuild: false,
    });
}