Plugin install
Hello, I tried to install a vue 3 compatible plugin :
in plugins/vue-vimeo-player.client.js :
import {vueVimeoPlayer} from 'vue-vimeo-player'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.component('VueVimeoPlayer', vueVimeoPlayer);
nuxtApp.vueApp.use(vueVimeoPlayer)
})
i use it like this in a component :
<ClientOnly>
<VueVimeoPlayer v-if="largerThanMd" ref="player" class=" mx-auto md:my-auto w-full bg-black" :options="myOptions" :video-id="videoId"/>
</ClientOnly>``
but i get this warning in console and can't get rid of it. Do you know why ?
runtime-core.esm-bundler.js:38 [Vue warn]: A plugin must either be a function or an object with an "install" function.
warn2 @ runtime-core.esm-bundler.js:38
use @ runtime-core.esm-bundler.js:4356
(anonyme) @ vue-vimeo-player.client.js:5
`3 Replies
probably easiest to make a Vimeo.client.vue component and just import that component
instead of adding it globally to vue
the docs say you don't even need the plugin if you import the component
ah which is your issue
the default export is the vue plugin, the named export is the component
I understood the first half of your answer but not the second, should i create a simple component where i import locally ?
and delete my plugin js ?
Look at the docs, you're using the code incorrectly