[Vuejs]-Imagekit SDK and NuxtJS: How to import SDK correctly?

2👍

I had the same issue. I found that by just changing the import statement in plugins/vueimagekit.js to const {ImageKit} = require('imagekitio-vue') the "ik-" components work.

Don’t forget to add the plugin line in nuxt.config.js.

2👍

Imagekit is a plugin that can be installed and then components ik-image, ik-upload and ik-context can be used globally anywhere in your app, if you want to use IKImage, IKContext or IKUpload individually in your specific file then you don’t need to register the Imagekit plugin, you can just import the respective component in that file and use IKImage component to load image instead of ik-image like this –

<IKImage :publicKey="publicKey" :urlEndpoint="urlEndpoint" :src="your_image_src" />

or like this

<IKContext :publicKey="publicKey" :urlEndpoint="urlEndpoint"> <IKImage :path="your_image_path" :transformation="[{ height: 300, width: 400 }]" /> </IKContext>

Leave a comment