feat: dynamically load heic2any to accelerate initial page loading speed

This commit is contained in:
Shirasawa
2025-09-05 20:07:12 +08:00
parent c0a47169fa
commit a74ec200b3
3 changed files with 16 additions and 6 deletions

View File

@@ -5,7 +5,6 @@
import DOMPurify from 'dompurify';
import { marked } from 'marked';
import heic2any from 'heic2any';
import { toast } from 'svelte-sonner';
@@ -32,7 +31,7 @@
} from '$lib/stores';
import {
blobToFile,
convertHeicToJpeg,
compressImage,
createMessagesList,
extractContentFromFile,
@@ -765,7 +764,7 @@
};
reader.readAsDataURL(
file['type'] === 'image/heic'
? await heic2any({ blob: file, toType: 'image/jpeg' })
? await convertHeicToJpeg(file)
: file
);
} else {