Browse Source

added check to prevent heic2any library load during server prerender

Abhinav-grd 4 years ago
parent
commit
961683d71a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/services/downloadManager.ts

+ 1 - 1
src/services/downloadManager.ts

@@ -10,6 +10,7 @@ const CryptoWorker: any =
     typeof window !== 'undefined' &&
     typeof window !== 'undefined' &&
     Comlink.wrap(new Worker('worker/crypto.worker.js', { type: 'module' }));
     Comlink.wrap(new Worker('worker/crypto.worker.js', { type: 'module' }));
 
 
+const heic2any = typeof window !== 'undefined' && require('heic2any');
 const TYPE_HEIC = 'heic';
 const TYPE_HEIC = 'heic';
 
 
 class DownloadManager {
 class DownloadManager {
@@ -91,7 +92,6 @@ class DownloadManager {
     };
     };
 
 
     private async convertHEIC2JPEG(fileBlob): Promise<Blob> {
     private async convertHEIC2JPEG(fileBlob): Promise<Blob> {
-        const heic2any = require('heic2any');
         return await heic2any({
         return await heic2any({
             blob: fileBlob,
             blob: fileBlob,
             toType: 'image/jpeg',
             toType: 'image/jpeg',