esrun is a lightweight CLI tool that executes TypeScript and modern JavaScript files directly using esbuild for near-instant compilation, without requiring a bundler. It supports custom tsconfig, top-level await, and watch mode for re-executing on file changes. It handles both CJS and ESM dependencies seamlessly. However, the package is deprecated as of version 3.2.30 (current stable). Maintainers recommend migrating to Bun or, for Node.js compatibility, tsx. Last useful release: 3.2.30, minimal maintenance since. Designed for quick demonstrations and test execution, it differentiates itself by zero-config setup and esbuild's speed, but is now superseded.
npm install esrunNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows a minimal TypeScript file with an async import, executed via esrun CLI.
Migrate to Bun (bun run file.ts) or tsx (npx tsx file.ts).
Use ESM imports (import) or use an older v2.x if absolutely required.
Correct: esrun --watch foo.ts. Wrong: esrun foo.ts --watch.
Set "compilerOptions": { "module": "esnext" } in tsconfig.json.Pass tsconfig via esrun --tsconfig=/path (still supported, but not guaranteed).
Change to dynamic import: const esrun = await import('esrun'); or switch to ESM.Use consistent ESM syntax: export/import, not module.exports/require.
Use absolute path or relative path from current working directory.