Merge pull request #17225 from ShirasawaSama/feat/dynamic-load-heic2any

feat: dynamically load heic2any to accelerate initial page loading speed and fix heic convert bug
This commit is contained in:
Tim Jaeryang Baek
2025-09-05 16:42:45 +04:00
committed by GitHub
3 changed files with 16 additions and 6 deletions
+12
View File
@@ -1538,3 +1538,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;
}
};