Webpack TypeError: Cannot read property 'call' of undefined

This is maybe similar to Why uncaught type error is not reported?

I am using raven-js in an app that is built by webpack v3. We recently had a bug where we had used webpack’s CommonsChunkPlugin to extract some common code to a new bundle, but missed adding that bundle to a page. This meant that some of the modules that were required to execute that page were not available at the time of execution. This results in an error like the following in the console:

Uncaught TypeError: Cannot read property 'call' of undefined

The line that throws that error looks like this:

modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

However, this error does not end up getting reported to Sentry. Do you know why this might be and if there is something I can do to make sure we are capturing errors like this?

I believe I can make it so this particular error is logged to Sentry by adding this code:

if (window.webpackJsonp) {
  window.webpackJsonp = Raven.wrap(window.webpackJsonp);
}

but it isn’t clear to me why this needs to be wrapped and other things don’t, and I wonder how many other calls I should be looking into wrapping with Raven. Does anyone know of a good guide on this topic?