Sentry Angularjs configuration

Currently using Angularjs where I want to log errors form Sentry:

So I installed sentry via npm i raven-js --save and then included ngRaven inside my required dependencies on my app module.

Next, I’m trying to set the installation parameters on my webpack.config.js file as follows:

const angular = require('angular');
const Raven = require('raven-js');

    .addPlugin(require('raven-js/plugins/angular'), angular)

But I get the following error when building the project with webpack:

ReferenceError: window is not defined
    at Object.<anonymous> (C:\www\laureate\unifiedportal-webapp\UnifiedPortal\node_modules\angular\angular.js:31766:4)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\www\laureate\unifiedportal-webapp\UnifiedPortal\node_modules\angular\index.js:1:63)
    at Module._compile (module.js:660:30)

The docs say nothing about this, any idea what might be going wrong?