TypeScript - Build & Tooling
Run TS directly
- tsx: zero-config runner for TS/ESM. Great DX for scripts and dev servers.
- ts-node: mature runner; often slower than tsx; integrates with register hooks.
Build options
- tsc: typecheck + emit. Pair with bundlers for apps.
- esbuild/swc: extremely fast transpilers; pair with
tsc --noEmit
for typecheck.
- tsup: thin wrapper around esbuild for libraries (CJS+ESM+types).
- Vite: dev server + build (Rollup) for web apps; first-class TS support.
- Webpack/Rollup: flexible bundlers; pick when you need specific plugins or outputs.
Recommended library setup
npm i -D typescript tsup
npx tsc --init
// package.json
{
"scripts": {
"build": "tsup src/index.ts --dts --format esm,cjs --sourcemap",
"typecheck": "tsc -p tsconfig.json --noEmit"
}
}