Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 566 Bytes

defined.md

File metadata and controls

23 lines (20 loc) · 566 Bytes

Решение проблемы глобальных переменных.

server.ts:

const domino = require('domino');
const fs = require('fs');
const path = require('path');
const template = fs.readFileSync(path.join(__dirname, '.', 'dist', 'index.html')).toString();
const win = domino.createWindow(template);

global['window'] = win;
Object.defineProperty(win.document.body.style, 'transform', {
  value: () => {
    return {
      enumerable: true,
      configurable: true
    };
  },
});

global['document'] = win.document;
global['CSS'] = null;