Vercel's Scriptc compiles TypeScript to 170KB native binaries

A Vercel Labs project runs TS command-line tools at ~2.4ms startup with no Node runtime, until loose types trigger a bundled fallback interpreter.

Nowline JUL 27 11:00 PM banner

Top AI stories from the last hour

Top AI stories from the last hour

Copy markdown

  • Zero-runtime TypeScript, in a 170KB binary

    Scriptc compiles typed TS straight to a native executable, with no V8 or Node bundled in. Static builds land at 170-200KB with roughly 2.4ms cold start and 1-4MB RSS, which Vercel benchmarks as competitive with Go, Rust and Zig on M-series hardware.

  • The catch: soft types fall back to QuickJS

    Anything too dynamic drops into a bundled QuickJS-ng interpreter (~620KB), and one Fibonacci demo compiled to all-float C. So untyped code and any-heavy npm deps (critics on HN peg it at ~80% of real TS repos) lose the native speedup. Treat it as AssemblyScript-class, not a drop-in Node replacement.

  • Embed npm packages and precompute with two knobs

    The --dynamic flag bakes npm dependencies into the binary at build time (pushing size to ~3MB), and comptime() runs code during compilation and inlines the result as a literal. Node APIs covered include fs, path, http/https, net, crypto and fetch.

  • Measure the payoff before you port anything

    Run scriptc coverage to see the percentage of your codebase that compiles statically versus falling back to the interpreter, so you can size the win on a real project instead of guessing. Primary target is macOS arm64, with Linux and Windows via cross-compilation.

  • Apache-2.0, alpha, and mostly AI-written

    It ships open under Apache-2.0 with differential testing against Node for correctness, but it is early. Reportedly ~918K lines landed in a single week, which commenters attribute to heavy AI codegen, a useful data point on what one small team now puts out.

  • What you could ship this weekend

    A CLI, git hook, or MCP server you would normally hand out as a Node script can now go out as one tiny native binary with millisecond startup and no runtime to install. Keep the hot paths fully typed to stay off the fallback interpreter.