{"id":21279,"library":"esbuild-plugin-tsc","title":"esbuild-plugin-tsc","description":"An esbuild plugin that delegates TypeScript compilation to the official tsc compiler, enabling support for features not natively handled by esbuild, such as emitDecoratorMetadata, experimental decorators, and other TypeScript-only transforms. Version 0.5.0 supports TypeScript ^4.0.0 || ^5.0.0 and ships TypeScript type definitions. It targets projects that need tsc for specific files (e.g., those using decorators) while letting esbuild handle the rest, or can force tsc for all files via the `force` option. Released as needed, with a focus on bridging gaps between esbuild's fast but limited TS support and tsc's full feature set.","status":"active","version":"0.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/thomaschaaf/esbuild-plugin-tsc","tags":["javascript","esbuild","esbuild-plugin","tsc","typescript"],"install":[{"cmd":"npm install esbuild-plugin-tsc","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-tsc","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-tsc","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a default function; ESM import is recommended. CommonJS require works but may cause interop issues in TypeScript.","wrong":"const esbuildPluginTsc = require('esbuild-plugin-tsc')","symbol":"default","correct":"import esbuildPluginTsc from 'esbuild-plugin-tsc'"},{"note":"There is no named export; only default export exists. Attempting named import will cause runtime undefined.","wrong":"import { esbuildPluginTsc } from 'esbuild-plugin-tsc'","symbol":"esbuildPluginTsc (as named import)","correct":"import { default as esbuildPluginTsc } from 'esbuild-plugin-tsc'"},{"note":"Options is a type-only export. Use import type to avoid emitting a value import. Only used in TypeScript code.","wrong":"import { Options } from 'esbuild-plugin-tsc'","symbol":"type Options","correct":"import type { Options } from 'esbuild-plugin-tsc'"}],"quickstart":{"code":"import esbuildPluginTsc from 'esbuild-plugin-tsc';\nimport * as esbuild from 'esbuild';\n\nawait esbuild.build({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outdir: 'dist',\n  plugins: [\n    esbuildPluginTsc({\n      force: false,\n      tsx: true\n    })\n  ],\n});","lang":"typescript","description":"Configures esbuild with the plugin to compile TypeScript, optionally enabling JSX support via tsx option."},"warnings":[{"fix":"Use esbuild's native TypeScript support for most projects; only apply this plugin on specific files via the esbuild plugin filter mechanism.","message":"This plugin runs tsc for files that match the filter, which is slower than esbuild's native TypeScript support. Do not use unless you need features esbuild cannot handle (e.g., emitDecoratorMetadata).","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use TypeScript's module settings directly in tsconfig.json instead.","message":"The `forceEsm` option may be removed in future versions as TypeScript's ESM handling evolves.","severity":"deprecated","affected_versions":"0.5.0"},{"fix":"Set `force: false` (default) and rely on esbuild's built-in handling for most files.","message":"If you set `force: true`, all TypeScript files will be compiled by tsc, negating esbuild's speed advantage. Only enable for files that require tsc.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install typescript: `npm install --save-dev typescript`","message":"The plugin requires TypeScript as a peer dependency; if not installed, the build will fail at runtime.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update imports to use default import: `import esbuildPluginTsc from 'esbuild-plugin-tsc'`","message":"Version 0.3.0 changed the default export from a named object to a function. Old import style (`import { esbuildPluginTsc }`) will not work.","severity":"breaking","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev typescript`","cause":"typescript is not installed as a peer dependency.","error":"Error: Cannot find module 'typescript'"},{"fix":"Change to `import esbuildPluginTsc from 'esbuild-plugin-tsc'`","cause":"Used named import `{ esbuildPluginTsc }` instead of default import.","error":"TypeError: esbuildPluginTsc is not a function"},{"fix":"Use `import esbuildPluginTsc from 'esbuild-plugin-tsc'` and ensure `esModuleInterop` is enabled in tsconfig.json.","cause":"TypeScript error due to incorrect import style (CommonJS vs ESM) or missing type definitions.","error":"error TS2349: This expression is not callable. Type 'typeof import(\"...\")' has no call signatures."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}