mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-19 21:00:40 +08:00
dynamic import
This commit is contained in:
parent
1fd77f68bd
commit
b2722a4c2e
@ -1,5 +1,3 @@
|
||||
import sharp from 'sharp';
|
||||
|
||||
class ImageProcessingError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
@ -38,9 +36,12 @@ export async function parseBase64Image(input: string, options: {
|
||||
throw new Error(`Image size (${imageBuffer.length} bytes) exceeds maximum allowed size (${options.maxBytes} bytes)`);
|
||||
}
|
||||
|
||||
// Dynamically import sharp
|
||||
const sharp = (await import('sharp')).default;
|
||||
|
||||
// Use Sharp to load image and get metadata
|
||||
let sharpImage: sharp.Sharp;
|
||||
let metadata: sharp.Metadata;
|
||||
let sharpImage: any;
|
||||
let metadata: any;
|
||||
|
||||
try {
|
||||
sharpImage = sharp(imageBuffer);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user