Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set property 'roundSlider' of undefined #8

Open
HassanZahirnia opened this issue May 6, 2021 · 2 comments
Open

Cannot set property 'roundSlider' of undefined #8

HassanZahirnia opened this issue May 6, 2021 · 2 comments

Comments

@HassanZahirnia
Copy link

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
Copy link
Author

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.

@soundar24
Copy link
Owner

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.. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants