rollup-plugin-tsc

raw JSON →
1.1.16 verified Mon Apr 27 auth: no javascript

Zero-config Rollup plugin for TypeScript transpilation using the official tsc compiler (not Babel). Version 1.1.16 is current, with infrequent releases. Simple setup by passing a tsconfig object directly; no separate tsconfig.json required. Lightweight alternative to @rollup/plugin-typescript, offering more control over compiler options but less ecosystem integration.

error Error: Could not find a TypeScript project. Use --project or pass tsconfig path.
cause No tsconfig provided via plugin options or --project flag.
fix
Pass tsconfig object to tsc() plugin call.
error TypeError: tsc is not a function
cause CommonJS require without accessing default export.
fix
Use const { default: tsc } = require('rollup-plugin-tsc'); or switch to ESM import.
gotcha Plugin does not emit declaration files (.d.ts). Use tsc --declaration separately or another plugin like rollup-plugin-dts.
fix Add a separate step to run tsc --emitDeclarationOnly or use rollup-plugin-dts.
gotcha Plugin uses tsc internally; tsc must be installed as a peer dependency. Missing tsc can cause cryptic errors.
fix Install TypeScript: npm install --save-dev typescript
gotcha The plugin only compiles .ts files that are imported in the Rollup bundle. Files not reached by imports are not compiled (like tsc --noEmit does).
fix Ensure all .ts files are imported or use a separate tsc check for type errors.
gotcha Compiler options like 'rootDir' and 'outDir' can conflict with Rollup's output; may cause unexpected errors.
fix Avoid setting rootDir/outDir in tsconfig; let Rollup handle output.
npm install rollup-plugin-tsc
yarn add rollup-plugin-tsc
pnpm add rollup-plugin-tsc

Minimal Rollup config with rollup-plugin-tsc transpiling TypeScript using inline tsconfig.

// rollup.config.js
import tsc from 'rollup-plugin-tsc';

export default {
  input: 'src/main.ts',
  output: { file: 'dist/main.js', format: 'cjs' },
  plugins: [
    tsc({
      compilerOptions: {
        target: 'es2019',
        module: 'esnext',
        strict: true,
        esModuleInterop: true
      },
    }),
  ],
};