imagekit-developer/imagekit-nodejs

Getting `TypeError: ImageKit is not a constructor`

Closed this issue · 5 comments

When imported the imagekit using require everything work well with no issue, but when imported the package using import ImageKit from "imagekit" keep getting TypeError: ImageKit is not a constructor, btw use the latest version of imagekit-nodejs.

Please share the minimum code to reproduce this problem.

Actually, i don't have even minimum code just wrote the first import line import ImageKit from "imagekit" and the result of ImageKit on console.log is undefined.

I will need more information from you to be able to help you. So please provide me with the minimum source code along with instructions to reproduce this issue, even if it is just one line.

gxvxc commented

I got the SDK working twith a nodeJS module, but I am getting the same error as @abouolia when trying to import the ES module of the package.

import ImageKitEsM from 'imagekit';
const ImageKit = require('imagekit');
console.log(ImageKit, ImageKitEsM);

This is the console output:
[Function: ImageKit] undefined

Running nodejs v18.12.1