Both are webpack loaders that use istanbul to instrument js files with istanbul-lib-instrument.
This fixes npm install which was failing with this error:
❯ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: istanbul-instrumenter-loader@3.0.1
npm ERR! Found: webpack@5.88.2
npm ERR! node_modules/webpack
npm ERR! dev webpack@"^5.88.2" from the root project
npm ERR! peer webpack@">=2" from babel-loader@8.2.3
npm ERR! node_modules/babel-loader
npm ERR! dev babel-loader@"^8.0.4" from the root project
npm ERR! 4 more (eslint-loader, grunt-webpack, karma-webpack, terser-webpack-plugin)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from istanbul-instrumenter-loader@3.0.1
npm ERR! node_modules/istanbul-instrumenter-loader
npm ERR! dev istanbul-instrumenter-loader@"^3.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@4.47.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^2.0.0 || ^3.0.0 || ^4.0.0" from istanbul-instrumenter-loader@3.0.1
npm ERR! node_modules/istanbul-instrumenter-loader
npm ERR! dev istanbul-instrumenter-loader@"^3.0.1" from the root project
Background
istanbul-instrumenter-loader is incompatible with webpack versions above 4.x, and since it's been abandoned, it lacks support for webpack5.x.
Other options considered
babel-plugin-istanbul was considered as a modern alternative but since it works at a Babel-level and is not a webpack loader, it was dropped in favor of a webpack-loader solution to keep changes to a minimum ensuring same behavior.
Note on insertions/deletions
Main changes are 2 lines, the rest is package-lock.json.
Type of change
[ ] Bug fix (non-breaking change that fixes an issue)
[ ] New feature (non-breaking change that adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[x] Maintenance
[ ] New release
Checklists
Development
[x] Lint rules pass locally
[x] The code changed/added as part of this pull request has been covered with tests
[x] All tests related to the changed code pass in development
Code review
[x] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
[x] "Ready for review" label attached to the PR and reviewers assigned
[ ] Issue from task tracker has a link to this pull request
[ ] Changes have been reviewed by at least one other engineer
Description of the change
This PR replaces the abandoned
istanbul-instrumenter-loader
withcoverage-istanbul-loader
.Both are webpack loaders that use istanbul to instrument js files with istanbul-lib-instrument.
This fixes
npm install
which was failing with this error:Background
istanbul-instrumenter-loader
is incompatible withwebpack
versions above4.x
, and since it's been abandoned, it lacks support forwebpack
5.x
.Other options considered
babel-plugin-istanbul
was considered as a modern alternative but since it works at a Babel-level and is not a webpack loader, it was dropped in favor of a webpack-loader solution to keep changes to a minimum ensuring same behavior.Note on insertions/deletions
Main changes are 2 lines, the rest is
package-lock.json
.Type of change
Checklists
Development
Code review