title: Angular Universal: MouseEvent is not defined
body: <p>I am running the command <code>dev:ssr</code> and getting the following exception in my Angular 10 Project:</p>
  <pre><code>Compiled successfully.
  ./dist/Project/server/main.js:220253
  Object(tslib__WEBPACK_IMPORTED_MODULE_0__[&quot;__metadata&quot;])(&quot;design:paramtypes&quot;, [MouseEvent]), 
  
  ReferenceError: MouseEvent is not defined
  </code></pre>
  <p>I am aware that there are similar issues out there with messages like <code>win/document/etc. is undefined</code>, however, the solutions for those issues did not work for me.</p>
  <p>I tried using <code>isPlatformBrowser()</code> and mocking browser behaviour with <code>domino</code>, however, no effect.</p>
  <p>My ng version:</p>
  <pre><code>
       _                      _                 ____ _     ___
      / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
     / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
    / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
   /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                  |___/
      
  
  Angular CLI: 10.2.0
  Node: 12.19.0
  OS: darwin x64
  
  Angular: 10.2.0
  ... animations, cli, common, compiler, compiler-cli, core, forms
  ... localize, platform-browser, platform-browser-dynamic
  ... platform-server, router
  Ivy Workspace: Yes
  
  Package                            Version
  ------------------------------------------------------------
  @angular-devkit/architect          0.1002.0
  @angular-devkit/build-angular      0.1002.0
  @angular-devkit/build-ng-packagr   0.1002.0
  @angular-devkit/core               10.2.0
  @angular-devkit/schematics         10.2.0
  @angular/cdk                       10.2.5
  @angular/fire                      5.4.2
  @angular/flex-layout               10.0.0-beta.32
  @angular/material                  10.1.3
  @angular/material-moment-adapter   10.2.5
  @nguniversal/builders              10.1.0
  @nguniversal/express-engine        10.1.0
  @schematics/angular                10.2.0
  @schematics/update                 0.1002.0
  ng-packagr                         10.1.2
  rxjs                               6.6.3
  typescript                         3.9.7
  </code></pre>
  <p>Any other ideas anyone?</p>
  <p>UPDATE:</p>
  <p>One of the libraries, where MouseEvent is used, has 2 occurences of it.</p>
  <p>The first one is the following (needed to detect if the user clicked outside of the component, to close it):</p>
  <pre><code>  @HostListener('document:click', ['$event'])
    clickedOutside(event: MouseEvent) {
      const clickedInside = this.innerClasses.some(innerClass =&gt; (event.target as HTMLElement).classList.contains(innerClass));
      if (!this.eRef.nativeElement.contains(event.target) &amp;&amp; !clickedInside) {
        this.closeDialog();
      }
    }
  </code></pre>
  <p>The other one is to focus on the input:</p>
  <pre><code>  onContainerClick(event: MouseEvent) {
      if ((event.target as Element).tagName.toLowerCase() !== 'input') {
        this.elRef.nativeElement.querySelector('input').focus();
      }
    }
  </code></pre>
  <p>As I metioned, I already tried to use <code>isPlatformBrowser()</code>, however, it does not have any effect, and I am still seeing that error message.</p>