zig-build, currently at version 0.3.0, is a modern library designed for building and cross-compiling Node.js native addons, with a strong focus on Node-API (N-API). It differentiates itself from traditional tools like node-gyp and cmake-js by directly leveraging the Zig compiler and its Clang wrapper, eliminating the need for system compilers. This approach enables first-class cross-compilation, automatic build caching, and static linking of libc++. The library exclusively supports N-API addons, intentionally deprecating legacy NAN addons, and does not handle native addon downloading at install time. Instead, it promotes the use of npm's `optionalDependencies` combined with `os`/`cpu` specific packages for improved user experience and reduced runtime dependencies. `zig-build` functions as a library within a JavaScript or TypeScript build script, providing configuration flexibility. The release cadence is currently irregular, characteristic of a rapidly evolving project in its early stages.
Verified import paths — ran on the pinned version, not inferred.
zig-build is designed as an ESM-first library; use `import` in a module context (e.g., .mjs file or `"type": "module"` in package.json).
Demonstrates how to configure and build a native Node.js addon for multiple operating system and architecture targets (Windows x64, Linux x64, Linux ARM64) within a single `build` script call.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.