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.
Instead of shipping a heavy runtime TypeScript transpiler inside your executable, Thinpack uses Node’s strip-only pass during packing:
Type-only import erasure: Statements using import type are erased prior to dependency analysis, so packages referenced solely for types do not have to exist at runtime or enter your payload.
Zero parser weight at runtime: Because types are already stripped when building the /app payload, your final executable never carries a TypeScript compiler.
Even tsc itself packs tiny: In docs/benchmarks.md and tests/apps/baseline.toml, Thinpack packages typescript@5.9.3 (tsc) into 6.53–9.00 MiB (3.88–5.65 MiB gzipped) vs 109.63 MiB in Bun and 149.82 MiB in Node SEA (where SEA fails to actually compile).
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.
When packing a TypeScript monorepo or CLI tool, keep three verified rules from docs/reference.md in mind:
Project root resolution: The payload is rooted at your entry file’s nearest package.json. Required dependencies resolved above that root (such as hoisted monorepo packages) fail the pack; keep runtime dependencies reachable below the project root.
Preserve-symlinks semantics: Resolution is lexical (matching Node’s --preserve-symlinks), so __dirname and require.resolve see the symlink location.
/app/** vs host filesystem: Packed TypeScript sources become read-only JS inside /app/** (writes return EROFS), while files read outside /app—such as a user’s local tsconfig.json—come straight from the host working directory.
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.
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.