title: Angular 9 SSR Build Serve eror -- ERROR ReferenceError: document is not defined
body: <p>ERROR ReferenceError: document is not defined</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import { readFileSync } from 'fs';
  const domino = require('domino');  // import the library `domino`
  const DIST_FOLDER = join(process.cwd(), 'dist/browser');
  const template = readFileSync(join(DIST_FOLDER, 'index.html')).toString(); // use `index.html` as template
  const win = domino.createWindow(template); // create object Window
  global['window'] = win;
  global['Event'] = win.Event;               // assign the `win.Event` to prop `Event`
  global['document'] = win.document;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Even Adding this in Server.ts Fixing Issue But In Performance TTFB Time is Too High.
  Any Having the Solution...?</p>