Here i am importing sharp and then try to use sharp, it is giving me error "sharp is not a function"
if anyone aware about this, then it would be great.
import * as sharp from "sharp";
const imageToResize = sharp(image);
imageToProcess.metadata().then((metadata) => {
})
Try importing sharp with import sharp from 'sharp';.
A namespace-style import like import as from cannot be called or constructed, and will cause a failure at runtime. If you need to import additional properties from sharp you can destructure them, like so: import sharp, { OverlayOptions } from 'sharp';
Thank you @Fdebijl.
It worked for me.