Registry /
testing / sourcemap-istanbul-instrumenter-loader
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
istanbul-instrumenter-loader
✓ require('istanbul-instrumenter-loader')
✗ import istanbulInstrumenterLoader from 'istanbul-instrumenter-loader'
This is a CommonJS module; ES imports will fail. Only use require().
Webpack config usage (preLoaders)
✓ preLoaders: [{ test: /\.js$/, include: path.resolve('src/components/'), loader: 'istanbul-instrumenter' }]
✗ loaders: [{ test: /\.js$/, include: path.resolve('src/components/'), loader: 'istanbul-instrumenter' }]
In webpack 1, the loader must be in preLoaders, not loaders, to run before other transformations.
Loader name in webpack config
✓ loader: 'istanbul-instrumenter'
✗ loader: 'sourcemap-istanbul-instrumenter'
The npm package name differs from the loader name. The correct loader name is 'istanbul-instrumenter', not 'sourcemap-istanbul-instrumenter'.
Shows webpack 1 karma setup with istanbul-instrumenter-loader in preLoaders for code coverage.
// Install: npm i -D istanbul-instrumenter-loader istanbul karma karma-webpack karma-coverage
// karma.conf.js
config.set({
files: ['test/index.js'],
preprocessors: { 'test/index.js': 'webpack' },
webpack: {
module: {
preLoaders: [
{
test: /\.js$/,
include: path.resolve('src/components/'),
loader: 'istanbul-instrumenter'
}
]
}
},
reporters: ['progress', 'coverage'],
coverageReporter: { type: 'text' }
});
// test/index.js
const testsContext = require.context('./src/components/', true, /\.js$/);
testsContext.keys().forEach(testsContext);
const componentsContext = require.context('../src/components/', true, /\.js$/);
componentsContext.keys().forEach(componentsContext);
Errors
Common errors & fixes
Module not found: Error: Cannot resolve module 'istanbul-instrumenter'
Loader name is missing the '-loader' suffix in webpack config.
fixUse 'istanbul-instrumenter-loader' in the loader field, or ensure webpack resolves the loader correctly.
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
Loader is not applied because it's placed in loaders instead of preLoaders (webpack 1).
fixMove the loader configuration to the preLoaders property.
Cannot find module 'istanbul'
Istanbul is not listed as a dependency, but it is a peer dependency.
fixRun npm i -D istanbul to install Istanbul explicitly.
Audit
Dependencies
istanbulrequiredCore instrumentation library
loader-utilsrequiredWebpack loader utilities