{"id":26510,"library":"ts-eager","title":"ts-eager","description":"ts-eager is a fast TypeScript runner and register hook that uses esbuild for eager compilation of all included files from tsconfig.json at startup, with fallback to lazy compilation for files outside the project. Version 2.0.2 is the latest stable release, updated to support esbuild v0.11.20 with compatibility for newer versions. It differentiates from ts-node by leveraging esbuild's speed for noticeable improvements in tasks like test runs, and offers fallback to ts-node for type-specific features like emitDecoratorMetadata and optional tsconfig-paths support for path mapping.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"github.com/mhart/ts-eager","tags":["javascript"],"install":[{"cmd":"npm install ts-eager","lang":"bash","label":"npm"},{"cmd":"yarn add ts-eager","lang":"bash","label":"yarn"},{"cmd":"pnpm add ts-eager","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Primary transpiler used for fast TypeScript compilation.","package":"esbuild","optional":false},{"reason":"Required for parsing tsconfig.json to determine file inclusion.","package":"typescript","optional":true},{"reason":"Optional fallback for emitDecoratorMetadata and other type-specific compilation.","package":"ts-node","optional":true},{"reason":"Optional for supporting TypeScript path mappings in tsconfig.","package":"tsconfig-paths","optional":true}],"imports":[{"note":"Use -r ts-eager/register or programmatically require it before your code.","wrong":"import 'ts-eager/register' // ES module imports may not work as a side-effect require","symbol":"ts-eager/register","correct":"require('ts-eager/register') // CommonJS require hook"}],"quickstart":{"code":"// Install dependencies\n// npm install -D ts-eager typescript esbuild\n\n// Create a TypeScript file: hello.ts\nexport function greet(name: string): string {\n  return `Hello, ${name}!`;\n}\n\n// Run with ts-eager\n// Command: node -r ts-eager/register -e \"const { greet } = require('./hello'); console.log(greet('World'));\"","lang":"typescript","description":"Shows how to use ts-eager as a require hook to run a TypeScript file with eager compilation."},"warnings":[{"fix":"Update to ts-eager@2 and esbuild@^0.11.20.","message":"Major version bump to v2.0.0 due to breaking changes in esbuild >=0.11.20. Older esbuild versions are incompatible.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Set environment variable ESBUILD_MAX_BUFFER=268435456 or upgrade to v2.0.1+.","message":"Default ESBUILD_MAX_BUFFER is 16MB which may be too small for medium projects; ts-eager v2.0.1+ sets 256MB if not already set.","severity":"gotcha","affected_versions":"<2.0.1"},{"fix":"Run tsc --noEmit in parallel or as a pre-build step.","message":"ts-eager only transpiles, does not type-check. Use tsc separately for type checking.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install ts-node: npm install -D ts-node","message":"Support for emitDecoratorMetadata requires ts-node to be installed as a fallback.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run node with --require ts-eager/register (CommonJS mode) or convert your project to CommonJS.","cause":"Using ts-eager in an ES module context where dynamic require is not allowed.","error":"Error: dynamic require of 'esbuild' is not supported"},{"fix":"Install typescript: npm install -D typescript","cause":"Typescript is not installed, but required to parse tsconfig.json.","error":"Error: Cannot find module 'typescript'"},{"fix":"Install esbuild: npm install -D esbuild","cause":"esbuild peer dependency not installed.","error":"Error: esbuild: Failed to resolve 'esbuild'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}