vue-round-slider icon indicating copy to clipboard operation
vue-round-slider copied to clipboard

Cannot set property 'roundSlider' of undefined

Open HassanZahirnia opened this issue 3 years ago • 2 comments

Hey, I'm trying to import this library in my Nuxt project. I simply create a plugin file with following content:

import Vue from 'vue'
import RoundSlider from 'vue-round-slider'
Vue.component('RoundSlider', RoundSlider)

But I get this error: Cannot set property 'roundSlider' of undefined

Am I doing something wrong here? Any helps would be appreciated. Thanks in advance

vue version: 2.6.12 nuxt version: 2.14.12 vue-round-slider version: 1.0.1

HassanZahirnia avatar May 06 '21 13:05 HassanZahirnia

I have found a solution to this issue. I just had to add this library to nuxt as a client-only plugin. It appears when it tries to compile the code during SSR, it gets into issues.

So simple solution is just :

plugins: [
    { src: '~plugins/vue-round-slider', mode: 'client' },
],

and then obviously wrapping the element in a <client-only> tag.

HassanZahirnia avatar May 08 '21 15:05 HassanZahirnia

Great.. actually I never tried with Nuxt, I ll check this once and anything needed to improve in the plugin side then ll consider that.. 👍

soundar24 avatar May 09 '21 17:05 soundar24