Thinpack v0.3.1: Pack tsc into 6.5–9.0 MiB with Rust + QuickJS (vs 109.6 MiB in Bun) →

Compile TypeScript to a Standalone Executable

Thinpack.js natively strips TypeScript types at pack time for .ts, .mts, and .cts files—so you can turn a TypeScript CLI directly into a 4–12 MiB binary without bundling tsc.

Quick Example: TypeScript File Straight to Binary

Pack cli.ts directly on macOS or Linux
cat <<'EOF' > cli.ts
interface Greeting { target: string; }
const msg: Greeting = { target: "Thinpack" };
console.log(`Hello from ${msg.target}!`);
EOF

thinpack pack cli.ts -o my-ts-cli
./my-ts-cli

How Thinpack Lowers TypeScript at Pack Time

Instead of shipping a heavy runtime TypeScript transpiler inside your executable, Thinpack uses Node’s strip-only pass during packing:

Supported vs Unsupported TypeScript Syntax (Important Caveats)

From docs/gaps.md, Thinpack enforces the exact same strip-only syntax boundary as Node.js without --experimental-transform-types:

Works Out of the Box

  • Type annotations, interface, and type aliases
  • import type / export type across .ts, .mts, .cts
  • Standard ESM and CommonJS mixed graphs

Fails at Pack Time (Needs Prior Build)

  • enum, namespace, and constructor parameter properties
  • import x = require(...), export =, and .tsx
  • Loading unstripped .ts files from host disk at runtime (returns ERR_UNKNOWN_FILE_EXTENSION)

Real Benchmark: Packing TypeScript Itself (tsc)

Because Thinpack preserves module file boundaries inside /app and traces static __dirname reads, it can package the entire TypeScript compiler (typescript@5.9.3, 107 files, 18 built-in capabilities) into a standalone executable—something Node 26.8.1 SEA fails to complete beyond printing --version.

Program Thinpack (MiB) Bun 1.4.4 (MiB) Node 26.8.1 SEA Thinpack cold / warm SEA startup
Hello World
hello.js
4.03 (~1.80 gz) 104.10 143.70 — Failed
tsc (ts 5.9)
typescript@5.9.3
9.00 (5.65 gz) 109.63 (50.19 gz) 149.82 (45.35 gz) 578 / 347 ms 77 ms
ESLint 10
eslint@10.15.0
6.93 (3.60 gz) 107.15 (49.78 gz) 147.25 (44.96 gz) 288 / 186 ms 64 ms
Prettier 3
prettier@3.10.1
7.41 (4.14 gz) 110.04 (50.85 gz) 143.57 (44.32 gz) 235 / 155 ms Failed
Terser 5
terser@5.51.2
6.06 (2.91 gz) 105.38 (49.48 gz) 144.94 (44.57 gz) 226 / 145 ms 35 ms
js-yaml 5
js-yaml@5.5.0
5.80 (2.69 gz) 104.29 (49.28 gz) 143.75 (44.37 gz) 150 / 100 ms Failed
pi-coding-agent
@earendil-works/pi-coding-agent@1.5.0
12.42 (7.16 gz) 115.24 (51.30 gz) 157.75 (46.94 gz) 983 / 702 ms Failed

Troubleshooting Dynamic Imports & Host Files

When packing a TypeScript monorepo or CLI tool, keep three verified rules from docs/reference.md in mind:

Frequently Asked Questions

Does Thinpack.js compile TypeScript without installing tsc or esbuild?

Yes. Thinpack runs Node’s strip-only pass on .ts, .mts, and .cts files at pack time and erases type-only imports before dependency resolution, so your packed binary carries zero TypeScript compiler overhead.

Which TypeScript syntax features are rejected by strip-only packing?

Matching Node without --experimental-transform-types, syntax that emits runtime code—enum, namespace, parameter properties, import x = require(), export =, and .tsx—fails at pack time. Transpile those constructs beforehand if your codebase uses them.

Can Thinpack even package the TypeScript compiler (tsc) itself?

Yes. In docs/benchmarks.md and baseline.toml, Thinpack packages typescript@5.9.3 (tsc) into 9.00 MiB (6.53 MiB on current main, 3.88–5.65 MiB gzipped) and executes real compilations when lib files are included via --include.

Can a packed binary dynamically load external .ts files from the host disk?

No. The runtime does not strip TypeScript outside the /app payload; requiring a host .ts file at runtime returns ERR_UNKNOWN_FILE_EXTENSION.

Frequently Asked Questions

Does Thinpack.js compile TypeScript without installing tsc or esbuild?

Yes. Thinpack runs Node’s strip-only pass on .ts, .mts, and .cts files at pack time and erases type-only imports before dependency resolution, so your packed binary carries zero TypeScript compiler overhead.

Which TypeScript syntax features are rejected by strip-only packing?

Matching Node without --experimental-transform-types, syntax that emits runtime code—enum, namespace, parameter properties, import x = require(), export =, and .tsx—fails at pack time. Transpile those constructs beforehand if your codebase uses them.

Can Thinpack even package the TypeScript compiler (tsc) itself?

Yes. In docs/benchmarks.md and baseline.toml, Thinpack packages typescript@5.9.3 (tsc) into 9.00 MiB (6.53 MiB on current main, 3.88–5.65 MiB gzipped) and executes real compilations when lib files are included via --include.

Can a packed binary dynamically load external .ts files from the host disk?

No. The runtime does not strip TypeScript outside the /app payload; requiring a host .ts file at runtime returns ERR_UNKNOWN_FILE_EXTENSION.

Related Guides & Benchmarks

How Capability Trimming Works →

See how Oxc traces TypeScript and JS modules before Cargo links your binary.

Compile Node.js App to .exe →

Package your app as a standalone Windows x64 executable.

Automate Multi-OS Releases →

Ship Linux, macOS, and Windows binaries automatically on tag push.

Ship 4–12 MB Node.js binaries. Star thinpack.js on GitHub.

thinpack.js is 100% MIT-licensed and actively developed in Rust + JavaScript. Star the repository to follow releases or request compatibility fixtures for your favorite CLI.