Skip to content

Installation

ZNTC ships as a set of npm packages. Pick the ones you need based on the scenario.

PackagePurposeIncludes
@zntc/coreCLI + Node/Bun in-process API (NAPI)zntc binary, transpile() / build() / buildSync() / watch() / vitePlugin()
@zntc/wasmBrowser · Edge · WASI runtimesWASM-built transpiler
@zntc/vite-pluginVite integrationDrop-in replacement for esbuild
@zntc/react-nativeReact Native bundler / RN 0.72+Metro-compatible surface
@zntc/initOverlay ZNTC onto an existing RN CLI projectzntc-init scaffolder

The most common scenario. Provides both the zntc command and import { ... } from '@zntc/core'.

Terminal window
bun add -d @zntc/core

The CLI is available immediately after install:

Terminal window
bunx zntc --bundle src/index.ts -o dist/bundle.js

JS API:

import { init, transpile, build, buildSync, vitePlugin } from "@zntc/core";
init();
// Transpile
const { code } = transpile("const x: number = 1;");
// Sync bundling
const result = buildSync({
entryPoints: ["src/index.ts"],
format: "esm",
minify: true,
});
// Async bundling with JS plugins
const result2 = await build({
entryPoints: ["src/index.ts"],
define: { "process.env.NODE_ENV": '"production"' },
plugins: [{
name: "css-plugin",
setup(build) {
build.onLoad({ filter: /\.css$/ }, () => ({
contents: 'export default "red";',
}));
},
}],
});
// Vite/Rollup plugin adapter
const result3 = await build({
entryPoints: ["src/index.ts"],
plugins: [
vitePlugin({
name: "env-replace",
transform(code) {
return code.replace("import.meta.env.MODE", '"production"');
},
}),
],
});

@zntc/core automatically pulls in the matching native binary (@zntc/core-darwin-arm64, @zntc/core-linux-x64-gnu, …) as an optional dependency.

For environments without Node.js (browser playgrounds, Cloudflare Workers, Deno):

Terminal window
bun add @zntc/wasm
import { init, transpile } from "@zntc/wasm";
await init();
const result = transpile("const x: number = 1;");
console.log(result.code); // "const x = 1;"

Drop-in replacement for esbuild:

Terminal window
bun add -d @zntc/vite-plugin
vite.config.ts
import { defineConfig } from "vite";
import zntc from "@zntc/vite-plugin";
export default defineConfig({
plugins: [zntc()],
});

Overlay ZNTC onto an existing React Native CLI project — one-shot:

Terminal window
bunx @zntc/init

See the React Native guide for the full option list.

Direct install:

Terminal window
bun add -d @zntc/core @zntc/react-native

To use the zntc command system-wide, independent of any specific project:

Terminal window
bun add -g @zntc/core

Build from source (contributors / latest main)

Section titled “Build from source (contributors / latest main)”

If you want to run the latest main (or your own modifications) instead of the published npm version:

  • Zig 0.15.2 (install via mise recommended)
  • Bun 1.3+ or Node.js 24+
  • Git
Terminal window
git clone https://github.com/ohah/zntc.git
cd zntc
zig build -Doptimize=ReleaseFast

Built binary: zig-out/bin/zntc. Add it to PATH and it works the same as the npm-installed CLI:

Terminal window
# ~/.zshrc or ~/.bashrc
export PATH="$PATH:/path/to/zntc/zig-out/bin"

To rebuild the NAPI / WASM artifacts directly:

Terminal window
zig build napi # native binary for @zntc/core
zig build wasm wasm-bundler # .wasm for @zntc/wasm