{"library":"rollup-plugin-typescript2","title":"Rollup Plugin for TypeScript with Error Diagnostics","description":"rollup-plugin-typescript2 is a Rollup plugin that integrates TypeScript compilation into the Rollup build process, with a primary focus on correctly reporting TypeScript syntactic and semantic diagnostic messages. It is a rewrite of the original `rollup-plugin-typescript`, offering more robust error reporting at the cost of being somewhat slower. The current stable version is 0.37.0, with releases occurring every few months, indicating active maintenance and ongoing compatibility updates with newer TypeScript versions (e.g., supporting TS 5.x since 0.36.0 and newer `moduleResolution` kinds). The plugin inherits most compiler options and file lists directly from `tsconfig.json`, but enforces or modifies a few specific options for optimal Rollup integration, such as `noEmit`, `noEmitOnError`, and `outDir` handling. It differentiates itself by ensuring comprehensive TypeScript error reporting, which was a limitation of its predecessors.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install rollup-plugin-typescript2"],"cli":null},"imports":["import typescript from 'rollup-plugin-typescript2';","const typescript = require('rollup-plugin-typescript2');","typescript({ tsconfig: './tsconfig.build.json' })"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import typescript from 'rollup-plugin-typescript2';\nimport { readFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst pkg = JSON.parse(readFileSync(join(process.cwd(), 'package.json'), 'utf8'));\n\nexport default {\n  input: 'src/index.ts',\n  output: [\n    {\n      file: pkg.main,\n      format: 'cjs',\n      sourcemap: true\n    },\n    {\n      file: pkg.module,\n      format: 'es',\n      sourcemap: true\n    }\n  ],\n  plugins: [\n    typescript({\n      tsconfig: './tsconfig.json',\n      typescript: require('typescript') // Ensure using the correct TypeScript version\n    })\n  ],\n  external: Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {}))\n};\n","lang":"typescript","description":"This configuration demonstrates how to integrate `rollup-plugin-typescript2` into a Rollup build, compiling a TypeScript entry point into both CommonJS and ES module formats, respecting a `tsconfig.json` file, and handling external dependencies defined in `package.json`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}