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();