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

@@ -1528,3 +1528,15 @@ export const getAge = (birthDate) => {
}
return age.toString();
};
export const convertHeicToJpeg = async (file: File) => {
const { default: heic2any } = await import('heic2any');
try {
return await heic2any({ blob: file, toType: 'image/jpeg' });
} catch (err: any) {
if (err?.message?.includes('already browser readable')) {
return file;
}
throw err;
}
};