DEV Community

Cover image for Simplify TypeScript builds with esbuild and skip tsc/tsx
Andreas Bergström
Andreas Bergström

Posted on • Edited on • Originally published at andreasbergstrom.dev

Simplify TypeScript builds with esbuild and skip tsc/tsx

If tsc (or tsx in dev) is the slow step in your TypeScript build, esbuild can replace both. A single npm script — esbuild $(find src -name '*.ts') --platform=node --target=esnext --outdir=build --format=cjs — does the same job in a fraction of the time, and --watch makes it usable as the dev compiler too.

The full post breaks down each esbuild flag (--platform, --target, --format, --outdir, --watch), shows the package.json scripts for build/dev/watch, and pairs it with concurrently for a single dev-server command.


Originally published at andreasbergstrom.dev — read the full post there.

Top comments (0)