rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar
https://docs.rollbar.com/docs/javascript
MIT License
566 stars 212 forks source link

Removed abandoned istanbul webpack loader and replaced it with another #1132

Closed matux closed 4 months ago

matux commented 4 months ago

Description of the change

This PR replaces the abandoned istanbul-instrumenter-loader with coverage-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:

❯ 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 webpack 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