{"id":22091,"library":"rollup-plugin-istanbul","title":"rollup-plugin-istanbul","description":"A Rollup plugin that provides seamless integration with Istanbul for code coverage. Version 5.0.0 supports Rollup v4 and uses istanbul-lib-instrument v6.0.1. Dropped Node.js 14 support in v5.0.0. Key differentiator: instruments source files before bundling to avoid instrumenting test code, with source map support. Released occasionally, maintained actively.","status":"active","version":"5.0.0","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-istanbul","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-istanbul","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-istanbul","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency, required to use the plugin.","package":"rollup","optional":false}],"imports":[{"note":"Package ships CommonJS but also exports ESM; default import is the plugin function.","wrong":"const istanbul = require('rollup-plugin-istanbul')","symbol":"default","correct":"import istanbul from 'rollup-plugin-istanbul'"},{"note":"TypeScript types are included; options interface is exported.","symbol":"IstanbulPluginOptions (TypeScript)","correct":"import type { IstanbulPluginOptions } from 'rollup-plugin-istanbul'"},{"note":"The plugin is a default export; no named exports in CJS.","wrong":"const { istanbul } = require('rollup-plugin-istanbul')","symbol":"require() in CommonJS","correct":"const istanbul = require('rollup-plugin-istanbul')"}],"quickstart":{"code":"import { rollup } from 'rollup';\nimport istanbul from 'rollup-plugin-istanbul';\n\nconst bundle = await rollup({\n  input: 'src/index.js',\n  plugins: [\n    istanbul({\n      exclude: ['test/**/*.js', 'node_modules/**'],\n      instrumenterConfig: {\n        esModules: true,\n        compact: true,\n        produceSourceMap: true,\n        autoWrap: true,\n        preserveComments: true\n      }\n    })\n  ]\n});\n\nawait bundle.write({\n  file: 'dist/bundle.js',\n  format: 'iife'\n});\n","lang":"javascript","description":"Shows how to use rollup-plugin-istanbul with Rollup to instrument source files for code coverage, excluding test files."},"warnings":[{"fix":"Upgrade Node.js to >=16 and review istanbul-lib-instrument migration.","message":"Node.js 14 dropped in v5.0.0; requires Node.js 16+. Also istanbul-lib-instrument v6.0.1 may have breaking changes in options.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use Node.js >=14 or stay on v3.x.","message":"v4.0.0: Dropped support for Node.js 10 and 12; istanbul-lib-instrument updated to v5.2.1.","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Explicitly set old defaults if needed; ensure Rollup >=1.20.0.","message":"v3.0.0: Defaults for autoWrap, preserveComments, esModules, produceSourceMap changed to true. Rollup minimum version 1.20.0. istanbul-lib-instrument v4.0.3.","severity":"breaking","affected_versions":">=3.0.0 <4.0.0"},{"fix":"Update instrumenterConfig options per istanbul-lib-instrument docs.","message":"v2.0.0: Switched from deprecated istanbul to istanbul-lib-instrument. API changed.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Always set exclude or include patterns to avoid instrumenting tests.","message":"The 'include' option defaults to all files if omitted; be sure to use 'exclude' to skip test files.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set output.sourcemap: true or 'inline' in Rollup config.","message":"Source maps must be enabled in both the plugin (produceSourceMap: true) and Rollup output for accurate coverage.","severity":"gotcha","affected_versions":">=1.1.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 rollup-plugin-istanbul","cause":"Package not installed or missing from dependencies.","error":"Error: Cannot find module 'rollup-plugin-istanbul'"},{"fix":"Use import istanbul from 'rollup-plugin-istanbul' (default import).","cause":"Using named import instead of default import.","error":"TypeError: istanbul is not a function"},{"fix":"Upgrade Rollup to ^1.20.0||^2.0.0||^3.0.0||^4.0.0.","cause":"Using an older version of Rollup.","error":"Error: [plugin:istanbul] This plugin only works with Rollup >=1.20.0"},{"fix":"Set instrumenterConfig.produceSourceMap: true and output.sourcemap: 'inline' or true.","cause":"produceSourceMap is false or Rollup output sourcemap is disabled.","error":"Error: Could not resolve source map from instrumented file"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}