I have an Angular 13 App, with uses @auth0/auth0-angular
.
When I tried to implement SSR, it spits out error that window is not defined.
I added the following to server.ts
const domino = require('domino');
const fs = require('fs');
const path = require('path');
const template = fs.readFileSync(path.join(__dirname, '..', 'browser', 'index.html')).toString();
const win = domino.createWindow(template);
global['window'] = win;
global['document'] = win.document;
This resolved few issues, however after hours of troubleshooting, I came to know that the remaining errors are spit by Auth0, @auth0/auth0-angular
.
I read this in @auth0/auth0-angular
docs and this in angular-universal
docs.
I now understand the issue and that there is a solution for it, that has been acknowledged by both the libraries, however I find it hard to implement.
I was wondering if there are some sample implementation for the same, of if there is anyone who has already done this?
Any help is appreciated. Thanking you all in anticipation.