From 38f84a94baffb3b321eddc49d4de413de4d20a5d Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 29 Jan 2022 22:18:12 +0900 Subject: [PATCH] lazy load browser-image-resizer --- packages/client/src/scripts/upload.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/client/src/scripts/upload.ts b/packages/client/src/scripts/upload.ts index 21f4a5d2d..4e37a5ddc 100644 --- a/packages/client/src/scripts/upload.ts +++ b/packages/client/src/scripts/upload.ts @@ -1,6 +1,5 @@ import { reactive, ref } from 'vue'; import { defaultStore } from '@/store'; -import { readAndCompressImage } from 'browser-image-resizer'; import { apiUrl } from '@/config'; import * as Misskey from 'misskey-js'; import { $i } from '@/account'; @@ -52,6 +51,8 @@ export function uploadFile(file: File, folder?: any, name?: string, keepOriginal debug: true, ...compressTypeMap[file.type], }; + + const { readAndCompressImage } = await import('browser-image-resizer'); resizedImage = await readAndCompressImage(file, config); ctx.name = `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}`; }