Skip to content

Instantly share code, notes, and snippets.

@DuncanFaulkner
Created Apr 5, 2021
Embed
What would you like to do?
ssr-4
const dominoModule = require('domino');
const fsModule = require('fs');
const indexTemplate = fsModule.readFileSync('dist/browser/index.html').toString();
const win = dominoModule.createWindow(indexTemplate);
(global as any).window = win;
(global as any).document = win.document;
(global as any).Event = win.Event;
(global as any).HTMLElement = win.HTMLElement;
(global as any).KeyboardEvent = win.KeyboardEvent;
(global as any).MouseEvent = win.MouseEvent;
(global as any).FocusEvent = win.FocusEvent;
(global as any).object = win.object;
(global as any).navigator = win.navigator;
(global as any).localStorage = win.localStorage;
(global as any).sessionStorage = win.sessionStorage;
(global as any).DOMTokenList = win.DOMTokenList;
// Can add other options as per your application configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment