lazy load browser-image-resizer
This commit is contained in:
parent
8a32cedf6e
commit
38f84a94ba
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,5 @@
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { defaultStore } from '@/store';
|
import { defaultStore } from '@/store';
|
||||||
import { readAndCompressImage } from 'browser-image-resizer';
|
|
||||||
import { apiUrl } from '@/config';
|
import { apiUrl } from '@/config';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
|
@ -52,6 +51,8 @@ export function uploadFile(file: File, folder?: any, name?: string, keepOriginal
|
||||||
debug: true,
|
debug: true,
|
||||||
...compressTypeMap[file.type],
|
...compressTypeMap[file.type],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { readAndCompressImage } = await import('browser-image-resizer');
|
||||||
resizedImage = await readAndCompressImage(file, config);
|
resizedImage = await readAndCompressImage(file, config);
|
||||||
ctx.name = `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}`;
|
ctx.name = `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue