Fix error in server-side rendering (#2039)

This commit is contained in:
Liwen Guo 2019-11-26 05:16:07 +01:00 committed by Niklas von Hertzen
parent 8c04f94bc9
commit e4d52a1ac6
1 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,9 @@ const html2canvas = (element: HTMLElement, options: Partial<Options> = {}): Prom
export default html2canvas;
CacheStorage.setContext(window);
if (typeof window !== "undefined") {
CacheStorage.setContext(window);
}
const renderElement = async (element: HTMLElement, opts: Partial<Options>): Promise<HTMLCanvasElement> => {
const ownerDocument = element.ownerDocument;