1👍
✅
The reason why this is happening is because you are running SSR with NodeJS and there is no window object, so you need a NodeJS replacement.
I suggest installing domino
npm i --save-dev domino
Then in your server.ts
const domino = require('domino');
const template = fs
.readFileSync(path.join('dist/browser', 'index.html')) // Or whereever your rendered index.html is
.toString();
const window = domino.createWindow(template);
(global as any).window = window;
(global as any).document = window.document;
Source:stackexchange.com