Ionic 4 ssr issue

error : ERROR TypeError: Cannot redefine property: constructor
** at Function.defineProperty ()**

i’m trying to use angular universal ssr in my app .
i got an error with self is not defined
then tried to use domino library like that :

  const domino = require('domino');
  const fs = require('fs');
  const path = require('path');
  const template = fs.readFileSync(path.join(distFolder, '.', '.', 'index.html')).toString();
  const win = domino.createWindow(template);
  global['window'] = win;
  global['self'] = win;

then this error error : ERROR TypeError: Cannot redefine property: constructor
** at Function.defineProperty ()**