Webpack 4 Production mode does not send errors

Hello!

I’m working on integrating sentry with my application and have run into a snag. It looks like whenever I build my client side bundle with webpack under production mode, sentry does not send uncaught errors.

Specifically running webpack --mode production does not send sentry errors (no XHR requests are being sent) whereas webpack --mode development does send the errors (XHR is present).

I am using the same webpack config for both the development and production modes. I am using the same plugins / build steps for dev / production.

I have also tried disabling optimizations that webpack 4 makes in production mode by adding the following to my config.

optimization: {
    sideEffects: false,
    minimize: false,
    usedExports: false,
    concatenateModules: false,
  },

I am able to see the uncaught error in the console in for both the dev and production bundles.

I do not have any code splitting or code chunking enabled.

I have used webpack-bundle-analyzer to ensure that raven-js is included in my production bundle.

“raven-js”: “^3.24.0”,
and
“webpack”: “^4.1.1”,
“webpack-cli”: “^2.0.10”,

If anyone has any recommendations I’d really appreciate the help!

Quick follow up -
If I run Raven.captureException(new Error('Manual capture')); Sentry is called appropriately. It appears that uncaught exceptions just are not logged.

e.g.

throw new Error('uncaught error')