Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added mocks for browser to fix window, document, HTMLElement an… #180

Merged
merged 2 commits into from
Apr 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,21 @@ if (process.env.TRUST_ICM) {
console.warn("ignoring all TLS verification as 'TRUST_ICM' variable is set - never use this in production!");
}

// uncomment this block to prevent ssr issues with third-party libraries regarding window, document, HTMLElement and navigator
// tslint:disable-next-line: no-commented-out-code
/*
const domino = require('domino');
const template = fs.readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString();
const win = domino.createWindow(template);

// tslint:disable:no-string-literal
global['window'] = win;
global['document'] = win.document;
global['HTMLElement'] = win.HTMLElement;
global['navigator'] = win.navigator;
// tslint:enable:no-string-literal
*/

// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
app.engine(
'html',
Expand Down