From 113088431659f7e3cd531e12a0d6f7eafb041d11 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 4 Jun 2020 14:13:54 +0200
Subject: [PATCH] Switch fabric to a dynamic import

We only need it for the preview, so we can load it in the background
---
 src/vpu-pdf-preview.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/vpu-pdf-preview.js b/src/vpu-pdf-preview.js
index be4e77f..6894040 100644
--- a/src/vpu-pdf-preview.js
+++ b/src/vpu-pdf-preview.js
@@ -8,7 +8,6 @@ import {MiniSpinner} from 'vpu-common';
 import * as commonUtils from "vpu-common/utils";
 import * as commonStyles from 'vpu-common/styles';
 import pdfjs from 'pdfjs-dist';
-import {fabric} from 'fabric';
 
 const i18n = createI18nInstance();
 
@@ -83,7 +82,8 @@ export class PdfPreview extends ScopedElementsMixin(VPULitElement) {
 
         window.addEventListener('resize', this._onWindowResize);
 
-        this.updateComplete.then(() => {
+        this.updateComplete.then(async () => {
+            const fabric = (await import('fabric')).fabric;
             that.canvas = that._('#pdf-canvas');
 
             // this._('#upload-pdf-input').addEventListener('change', function() {
-- 
GitLab