Closed Ankit006 closed 7 months ago
Hi, I try to use imageKit in my nestjs backend, So I had created a ImageStorageModule and ImageStorage Service
ImageStorageModule
import { Module } from '@nestjs/common'; import { ImageStorageService } from './image-storage.service'; @Module({ providers: [ImageStorageService], }) export class ImageStorageModule {}
and here is the ImageStorageService
import { Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import ImageKit from 'imagekit'; @Injectable() export class ImageStorageService { constructor(private configService: ConfigService) { const imageKit = new ImageKit({ publicKey: configService.get<string>('IMAGEKIT_PUBLIC_KEY'), privateKey: configService.get<string>('IMAGEKIT_PRIVATE_KEY'), urlEndpoint: configService.get<string>('IMAGEKIT_URL_ENDPOINT'), }); } }
But when I am creating an instance of ImageKit, I am getting this error "TypeError: imagekit_1.default is not a constructor"
Ok, I fixed the problem. I just had to add esModuleInterop:true in the tsconfig.json.
esModuleInterop:true
Hi, I try to use imageKit in my nestjs backend, So I had created a ImageStorageModule and ImageStorage Service
ImageStorageModule
and here is the ImageStorageService
But when I am creating an instance of ImageKit, I am getting this error "TypeError: imagekit_1.default is not a constructor"