{"id":22262,"library":"rollup-plugin-ts-compiler","title":"rollup-plugin-ts-compiler","description":"A TypeScript compiler plugin for Rollup that uses the TypeScript Compiler API with incremental program for fast compilation. Version 1.0.18 is stable. The plugin supports compiler errors, incremental builds, declarations, source maps, and monorepo setups. It differs from alternatives like rollup-plugin-typescript2 and @rollup/plugin-typescript by using modern TypeScript APIs for performance, but at the cost of bypassing Rollup's preceding pipeline.","status":"active","version":"1.0.18","language":"javascript","source_language":"en","source_url":"https://github.com/eilrix/rollup-plugin-ts-compiler","tags":["javascript","rollup","typescript","compiler","plugin"],"install":[{"cmd":"npm install rollup-plugin-ts-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-ts-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-ts-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as a peer dependency to function as a Rollup plugin.","package":"rollup","optional":false},{"reason":"Required as a peer dependency to compile TypeScript.","package":"typescript","optional":false}],"imports":[{"note":"The library is ESM-only; CommonJS require() will fail.","wrong":"const typescript = require('rollup-plugin-ts-compiler')","symbol":"default","correct":"import typescript from 'rollup-plugin-ts-compiler'"},{"note":"The default export is the plugin function; there is no named export.","wrong":"import { typescript } from 'rollup-plugin-ts-compiler'","symbol":"typescript","correct":"import typescript from 'rollup-plugin-ts-compiler'"},{"note":"Options type is only exported as a TypeScript type, not a runtime value.","wrong":"import { TypeScriptPluginOptions } from 'rollup-plugin-ts-compiler' (without type)","symbol":"TypeScriptPluginOptions","correct":"import type { TypeScriptPluginOptions } from 'rollup-plugin-ts-compiler'"}],"quickstart":{"code":"import typescript from 'rollup-plugin-ts-compiler';\n\nexport default {\n  input: './src/index.ts',\n  output: {\n    file: './dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    typescript({\n      compilerOptions: {\n        target: 'es2020',\n        module: 'esnext'\n      }\n    })\n  ]\n};","lang":"typescript","description":"Shows basic usage of rollup-plugin-ts-compiler with Rollup, including compiler options override."},"warnings":[{"fix":"Place this plugin before any other plugins that need to transform TypeScript code, or be aware that earlier plugins won't affect compiled output.","message":"Bypasses Rollup's preceding pipeline: the plugin reads .ts files directly from the filesystem, ignoring any previous Rollup plugins that modify TypeScript source code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use default import: import typescript from 'rollup-plugin-ts-compiler'","message":"Named export removed in v1.0.0: prior versions exported a named function 'typescript', but now the default export is the plugin function.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Only enable monorepo when you have local packages in a monorepo; otherwise leave it false.","message":"Monorepo mode can cause unnecessary recompilation: setting 'monorepo: true' forces the plugin to watch and recompile files outside the project root, which may include large node_modules in non-monorepo contexts.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Avoid relying on sharedState for long-term; monitor releases for alternatives.","message":"Shared state via 'sharedState' option may be deprecated in future versions. No official deprecation notice, but consider using Rollup's native caching mechanisms.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Switch to ESM (e.g., add 'type': 'module' in package.json) or use dynamic import().","cause":"Using CommonJS require() to load the ESM-only library.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Use default import: import typescript from 'rollup-plugin-ts-compiler'","cause":"Using named import 'typescript' instead of default import.","error":"TypeError: typescript is not a function"},{"fix":"Ensure the overridden options are valid according to TypeScript's constraints.","cause":"Incompatible compilerOptions override violating TypeScript rules.","error":"The 'compilerOptions' option does not match tsconfig.json: 'module' can only be 'ES2015', 'ES2020', 'ESNext', etc. when target is 'ESNext'."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}