From 7102e43e1e85bd9ae5708dd62096ee03c141c6ea Mon Sep 17 00:00:00 2001 From: tamaina Date: Mon, 7 Feb 2022 03:26:22 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A8=E3=83=A9=E3=83=BC=E3=83=8F=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=83=AA=E3=83=B3=E3=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/scripts/upload.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/client/src/scripts/upload.ts b/packages/client/src/scripts/upload.ts index ee3b41475..ccba142c5 100644 --- a/packages/client/src/scripts/upload.ts +++ b/packages/client/src/scripts/upload.ts @@ -62,9 +62,13 @@ export function uploadFile( ...(changeType ? {} : { mimeType: file.type }), }; - const { readAndCompressImage } = await import('browser-image-resizer'); - resizedImage = await readAndCompressImage(file, config); - ctx.name = changeType ? `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}` : ctx.name; + try { + const { readAndCompressImage } = await import('browser-image-resizer'); + resizedImage = await readAndCompressImage(file, config); + ctx.name = changeType ? `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}` : ctx.name; + } catch (e) { + console.error('Failed to resize image', e); + } } const data = new FormData();