tsc-esbuild

raw JSON →
0.0.1-0 verified Fri May 01 auth: no javascript

tsc-esbuild is a thin wrapper that runs TypeScript's compiler (tsc) for type checking but delegates actual JavaScript/declaration file emission to esbuild for dramatically faster builds. Version 0.0.1-0 is the initial prerelease with peer dependency on TypeScript 3.x or 4.x. Unlike ts-speedy or other hybrid approaches, this package directly patches the tsc API to intercept output, making it drop-in compatible with existing tsc invocations. It targets Node.js environments (CLI) and is not intended for browser use. Release cadence is irregular as it's in early development.

error Error: Cannot find module 'esbuild'
cause esbuild peer dependency not installed; package uses it at runtime.
fix
Run npm install esbuild or add it to your package.json.
error TypeScript error: 'TscEsbuildOptions' is not a valid type
cause Importing type from wrong path or not using type import.
fix
Use import type { TscEsbuildOptions } from 'tsc-esbuild' instead of regular import.
error TypeError: tscEsbuild is not a function
cause Using `new tscEsbuild()` or incorrect import (e.g., CommonJS require).
fix
Import with import tscEsbuild from 'tsc-esbuild' and call as tscEsbuild(options).
breaking Requires TypeScript 3.x or 4.x only; not compatible with TypeScript 5.x.
fix Downgrade TypeScript to 4.x or wait for package update.
gotcha Default export is a function, not a class; calling without `new` is correct.
fix Use `tscEsbuild(options)` directly, not `new tscEsbuild()`.
deprecated The `emitOnAll` option (if used) is deprecated; use `emitOn` instead.
fix Replace `emitOnAll` with `emitOn: 'all'` in options.
gotcha esbuild must be installed separately; not bundled.
fix Run `npm install esbuild --save-dev` in your project.
npm install tsc-esbuild
yarn add tsc-esbuild
pnpm add tsc-esbuild

Shows programmatic usage with async/await, passing tsconfig path and esbuild options.

import tscEsbuild from 'tsc-esbuild';

const options = {
  tsconfig: './tsconfig.json',
  esbuildOptions: {
    target: 'es2020',
    format: 'esm',
  },
};

async function build() {
  try {
    const result = await tscEsbuild(options);
    console.log('Build succeeded:', result.outputFiles);
  } catch (err) {
    console.error('Build failed:', err);
  }
}

build();