Registry / devops / ts-eager

ts-eager

JSON →
library2.0.2jsnpmunverified

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.

npm install ts-eager
INSTALL
IMPORT
SIG · TS-EAGER
T
ts-eager
devopsjavascriptv2.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ts-eager/register
require('ts-eager/register') // CommonJS require hook
import 'ts-eager/register' // ES module imports may not work as a side-effect require
Use -r ts-eager/register or programmatically require it before your code.

Shows how to use ts-eager as a require hook to run a TypeScript file with eager compilation.

// Install dependencies // npm install -D ts-eager typescript esbuild // Create a TypeScript file: hello.ts export function greet(name: string): string { return `Hello, ${name}!`; } // Run with ts-eager // Command: node -r ts-eager/register -e "const { greet } = require('./hello'); console.log(greet('World'));"
ts-eager --version
Debug
Known issues
breakingMajor version bump to v2.0.0 due to breaking changes in esbuild >=0.11.20. Older esbuild versions are incompatible.
fix
Update to ts-eager@2 and esbuild@^0.11.20.
affects: <2.0.0
gotchaDefault ESBUILD_MAX_BUFFER is 16MB which may be too small for medium projects; ts-eager v2.0.1+ sets 256MB if not already set.
fix
Set environment variable ESBUILD_MAX_BUFFER=268435456 or upgrade to v2.0.1+.
affects: <2.0.1
gotchats-eager only transpiles, does not type-check. Use tsc separately for type checking.
fix
Run tsc --noEmit in parallel or as a pre-build step.
affects: >=0.0.0
deprecatedSupport for emitDecoratorMetadata requires ts-node to be installed as a fallback.
fix
Install ts-node: npm install -D ts-node
affects: >=0.0.0
Errors
Common errors & fixes
Error: dynamic require of 'esbuild' is not supported
Using ts-eager in an ES module context where dynamic require is not allowed.
fix
Run node with --require ts-eager/register (CommonJS mode) or convert your project to CommonJS.
Error: Cannot find module 'typescript'
Typescript is not installed, but required to parse tsconfig.json.
fix
Install typescript: npm install -D typescript
Error: esbuild: Failed to resolve 'esbuild'
esbuild peer dependency not installed.
fix
Install esbuild: npm install -D esbuild
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
esbuildrequiredPrimary transpiler used for fast TypeScript compilation.
typescriptoptionalRequired for parsing tsconfig.json to determine file inclusion.
ts-nodeoptionalOptional fallback for emitDecoratorMetadata and other type-specific compilation.
tsconfig-pathsoptionalOptional for supporting TypeScript path mappings in tsconfig.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
ts-eager — npm install ts-eager · libregistry