A fast on-the-fly transpiler for modern JS, TypeScript, and JSX using esbuild. Current stable version is 2.2.2. Designed as a drop-in replacement for ts-node with significantly faster startup and transpilation by leveraging esbuild instead of the TypeScript compiler. Supports both bundle mode (default) and transform mode with caching. Works as a binary (esr), as a Node.js require hook (-r esbuild-runner/register), and as a Jest transformer. Requires esbuild as a peer dependency.
npm install esbuild-runnerVerified import paths — ran on the pinned version, not inferred.
Create a simple TypeScript file and run it with esr binary, or configure Jest to use esbuild-runner for transforming TypeScript.
Install esbuild: npm install --save-dev esbuild
Use transform mode: esr --cache script.ts
Run esr --clearCache before starting fresh runs, or delete the cache directory manually.
Only use the require hook in development or for specific scripts.
Use npx esr or add esr to PATH.
npm install --save-dev esbuild
Use CommonJS syntax or ensure your file is compiled to CommonJS before using esr.
Create esbuild-runner.config.js and set esbuild options like target, loader, etc.