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

Nuxt component registration? #32

Closed
IHIutch opened this issue May 21, 2020 · 5 comments
Closed

Nuxt component registration? #32

IHIutch opened this issue May 21, 2020 · 5 comments

Comments

@IHIutch
Copy link

IHIutch commented May 21, 2020

I can't seem to get this to work with nuxt. I keep getting the warning: Unknown custom element: <unicon> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

My plugin/vue-unicons.js looks like this

import Vue from "vue";
import Unicon from "vue-unicons";
import { uniCarWash } from "vue-unicons/src/icons";

Unicon.add([uniCarWash]);
Vue.use(Unicon);

My nuxt config looks like this:

plugins: [{ src: "~/plugins/vue-unicons.js", mode: "client" }],

Maybe this is a SSR issue?

@IHIutch
Copy link
Author

IHIutch commented May 21, 2020

Also seems like if you are using SSR, you need to wrap your unicon component with client-only like so:

<client-only>
     <unicon name="car-wash" fill="limegreen"></unicon>
</client-only>

Otherwise, you get this warning:
The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

@antonreshetov
Copy link
Owner

Yeah, I forgot to include the use of <client-only> in the documentation.
https://codesandbox.io/s/sad-wing-p2uvq?file=/pages/index.vue

@IHIutch
Copy link
Author

IHIutch commented May 30, 2020

That part I've figured out, but I still am getting the error Unknown custom element: <unicon> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

My configuration is here:

@IHIutch
Copy link
Author

IHIutch commented May 30, 2020

After some further inspection it looks like it might be a caching issue. Removing node_modules, .nuxt, and rebuilding package-lock.json seem to have it working

@IHIutch IHIutch closed this as completed Jun 1, 2020
@IHIutch
Copy link
Author

IHIutch commented Jun 1, 2020

Not sure if this is something to look into, but I'm going to close this issue as I'm able to get it working now.

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