{"id":22092,"library":"rollup-plugin-istanbul2","title":"rollup-plugin-istanbul","description":"Rollup plugin for seamless integration with Istanbul code coverage instrumentation. Current stable version is 5.0.0, released with support for Rollup v4 and Node.js 16+. It instruments source files before bundling, ensuring test code is not covered. Key differentiators: works as a Rollup plugin, supports source maps, configurable instrumenter options, and minimal setup. Published under MIT license, maintained by artberri. Released at a moderate cadence with 5 major versions.","status":"active","version":"2.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/artberri/rollup-plugin-istanbul","tags":["javascript","rollup-plugin","istanbul","es2015","es6","rollup","coverage"],"install":[{"cmd":"npm install rollup-plugin-istanbul2","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-istanbul2","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-istanbul2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin requires Rollup >=1.17.0 (v5 requires Rollup >=4)","package":"rollup","optional":false},{"reason":"runtime dependency for instrumentation logic","package":"istanbul-lib-instrument","optional":false}],"imports":[{"note":"The plugin exports a default function; named import is incorrect.","wrong":"import { istanbul } from 'rollup-plugin-istanbul'","symbol":"default (istanbul)","correct":"import istanbul from 'rollup-plugin-istanbul'"},{"note":"In CommonJS, .default is required because the module uses ESM internally.","wrong":"const istanbul = require('rollup-plugin-istanbul');","symbol":"require (CJS)","correct":"const istanbul = require('rollup-plugin-istanbul').default;"},{"note":"TypeScript types are included; default import works with esModuleInterop.","wrong":"","symbol":"TypeScript usage","correct":"import istanbul from 'rollup-plugin-istanbul';"}],"quickstart":{"code":"// Install: npm install --save-dev rollup rollup-plugin-istanbul\n// rollup.config.js\nimport istanbul from 'rollup-plugin-istanbul';\n\nexport default {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js', format: 'iife' },\n  plugins: [\n    istanbul({\n      exclude: ['test/**/*.js']\n    })\n  ]\n};\n","lang":"javascript","description":"Minimal Rollup configuration using rollup-plugin-istanbul to instrument source files, excluding test directory."},"warnings":[{"fix":"Update to >=2.0.0 and use istanbul-lib-instrument compatible options (see instrumenterConfig).","message":"v2.0.0: Switch from istanbul to istanbul-lib-instrument; older istanbul options no longer work.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"If you relied on old defaults, explicitly set these options to false in instrumenterConfig.","message":"v3.0.0: Defaults for autoWrap, preserveComments, esModules, produceSourceMap changed to true. Minimum Node.js 10 required.","severity":"breaking","affected_versions":"<3.0.0"},{"fix":"Upgrade Node to >=14 and test coverage output for changes.","message":"v4.0.0: Dropped Node 10 and 12, istanbul-lib-instrument version ^5.2.1; coverage location fix may change output.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Upgrade Node to >=16, Rollup to >=4, and update instrumenterConfig if needed.","message":"v5.0.0: Dropped Node 14, Rollup v4 required, istanbul-lib-instrument ^6.0.1.","severity":"breaking","affected_versions":"<5.0.0"},{"fix":"Always set 'exclude' option (e.g., exclude: ['test/**/*.js']) to prevent instrumenting test files.","message":"Plugin applies to all files in include glob by default; test files must be excluded to avoid instrumenting test code.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass compact via instrumenterConfig: { compact: true }.","message":"The 'compact' option in plugin options is deprecated; use instrumenterConfig.compact instead.","severity":"deprecated","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: import istanbul from 'rollup-plugin-istanbul';","cause":"Using named import { istanbul } instead of default import in ESM.","error":"Error: 'default' is not exported by rollup-plugin-istanbul"},{"fix":"Use: const istanbul = require('rollup-plugin-istanbul').default;","cause":"In CommonJS, require returns an object with .default property.","error":"TypeError: istanbul is not a function"},{"fix":"Run: npm install --save-dev istanbul-lib-instrument","cause":"Missing dependency for istanbul-lib-instrument.","error":"Error: Cannot find module 'istanbul-lib-instrument'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}