Skip to content

Commit 475d8ba

Browse files
author
Andrea Barbasso
committed
[DSC-1778] add domino
1 parent f6af42e commit 475d8ba

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
"date-fns": "^2.29.3",
119119
"date-fns-tz": "^1.3.7",
120120
"deepmerge": "^4.3.1",
121+
"domino": "^2.1.6",
121122
"ejs": "^3.1.9",
122123
"express": "^4.18.2",
123124
"express-rate-limit": "^5.1.3",

server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import * as express from 'express';
2525
import * as ejs from 'ejs';
2626
import * as compression from 'compression';
2727
import * as expressStaticGzip from 'express-static-gzip';
28+
import * as domino from 'domino';
2829
/* eslint-enable import/no-namespace */
2930
import axios from 'axios';
3031
import LRU from 'lru-cache';
@@ -79,6 +80,14 @@ let anonymousCache: LRU<string, any>;
7980
// extend environment with app config for server
8081
extendEnvironmentWithAppConfig(environment, appConfig);
8182

83+
// Create a DOM window object based on the template
84+
const _window = domino.createWindow(indexHtml);
85+
86+
// Assign the DOM window and document objects to the global object
87+
(global as any).window = _window;
88+
(global as any).document = _window.document;
89+
(global as any).navigator = _window.navigator;
90+
8291
// The Express app is exported so that it can be used by serverless Functions.
8392
export function app() {
8493

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5398,7 +5398,7 @@ domhandler@^5.0.2, domhandler@^5.0.3:
53985398
dependencies:
53995399
domelementtype "^2.3.0"
54005400

5401-
domino@^2.1.2:
5401+
domino@^2.1.2, domino@^2.1.6:
54025402
version "2.1.6"
54035403
resolved "https://registry.yarnpkg.com/domino/-/domino-2.1.6.tgz#fe4ace4310526e5e7b9d12c7de01b7f485a57ffe"
54045404
integrity sha512-3VdM/SXBZX2omc9JF9nOPCtDaYQ67BGp5CoLpIQlO2KCAPETs8TcDHacF26jXadGbvUteZzRTeos2fhID5+ucQ==

0 commit comments

Comments
 (0)