A Webpack loader that uses Istanbul to add code coverage instrumentation to JavaScript/TypeScript files. Current stable version is 3.0.5. Release cadence is low; last major update was in 2020. Key differentiators include support for modern Istanbul API (istanbul-lib-instrument) and better source map handling compared to the older istanbul-instrumenter-loader. Ships TypeScript definitions. Requires Node >=10 and Webpack 4+. Works with Karma, TypeScript, and custom options.
npm install coverage-istanbul-loaderVerified import paths — ran on the pinned version, not inferred.
Configures Webpack to instrument JavaScript files for code coverage using Istanbul, with modern options.
Use import or dynamic import(), or downgrade to v2.x.
Ensure this loader is listed last in the 'use' array (i.e., executed first).
Replace 'instrumenter' with 'istanbul-lib-instrument' options (e.g., 'esModules').
Set produceSourceMap: true in loader options.
npm install @jsdevtools/coverage-istanbul-loader --save-dev
Use dynamic import: const loader = (await import('@jsdevtools/coverage-istanbul-loader')).default;npm install istanbul-lib-instrument --save-dev