Hi I am trying to run imageKit to optimize image on NextJS14
However, I am running into trouble when using a component with "use client".
import imagekit from '../globalComponents/imageKitConfig';
const imageURL = imagekit.url({
src: "https://ik.imagekit.io/jsfia/default-image.jpg?updatedAt=1685008465289",
transformation: [{
height: "300",
width: "400"
}]
});
Will give me:
TypeError: url_1.URLSearchParams is not a constructor
I tried using solution:
if (typeof window === 'undefined') {
imageURL = imagekit.url({
src: "https://ik.imagekit.io/jsfia/default-image.jpg?updatedAt=1685008465289",
transformation: [{
height: "300",
width: "400"
}]
});
}
However, i don't get the image I wanted. just blank image. (error)