[Vuejs]-Error: Could not find declaration file for module VueJS application

0👍

The issue was I had not installed the plugin with VueJS app. Here is how to do it.

VueJS

We can use Vue.use to isntall a plugin before it can be used like below

import Vue from 'vue';
import VueCroppie from 'vue-croppie';

Vue.use(VueCroppie)

NuxtJS

In case of NuxtJS it is little different. The plugin is registered globally, here’s how.

  1. Create a file called vue-croppie.js under plugin folder. And add the following to it

    import Vue from 'vue'
    import VueCroppie from 'vue-croppie'
    
    Vue.use(VueCroppie)
    
  2. In your nuxt.config.js add this under plugins

{ src: '~/plugins/vue-croppie.js', ssr: false }

Now, the plugin will be available globally. So there is no need to import and can be used directly.

Leave a comment