niklashaug / vue-carbonbadge

Vue component for the Website Carbon Badge compatible with Vue 3
4 stars 0 forks source link

Cannot read properties of undefined (reading '_c') - when used in Nuxt app #3

Open toddpadwick opened 8 months ago

toddpadwick commented 8 months ago

I am trying to use this component in my Nuxt 3 app. but i am getting this error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_c')
    at Proxy.c (vue-carbonbadge.js?v=b3df13c8:1089:62)

setup

/plugins/vue-carbonbadge.client.js

import CarbonBadge from 'vue-carbonbadge';

export default defineNuxtPlugin(({ vueApp }) => {
  vueApp.use(CarbonBadge)
})

( i have also tried as a non client only plugin but same issue persists)

niklashaug commented 8 months ago

Hey @toddpadwick! I did not actually try to get it running with Nuxt but have you already tried it that way? https://github.com/niklashaug/vue-carbonbadge/issues/1#issuecomment-854000485

If not, can you create a minimal Nuxt app where you're trying to use the CarbonBadge and share a repo link so I can have a look into this?

niklashaug commented 8 months ago

Hello @toddpadwick, I've just published a new version (2.0.0) of vue-carbonbadge with support for Vue 3. Can you check if you can use the library now in your setup?

rugor commented 3 months ago

Doesn't work for nuxt 3, even when wrapping with <ClientOnly></ClientOnly> Screenshot 2024-07-11 at 11 01 07 AM Screenshot 2024-07-11 at 11 14 11 AM Screenshot 2024-07-11 at 11 15 09 AM Screenshot 2024-07-11 at 11 19 48 AM

seems like the api service is working tho: https://api.websitecarbon.com/site?url=https%3A%2F%2Fwww.wholegraindigital.com%2F

niklashaug commented 2 months ago

Doesn't work for nuxt 3, even when wrapping with <ClientOnly></ClientOnly> Screenshot 2024-07-11 at 11 01 07 AM Screenshot 2024-07-11 at 11 14 11 AM Screenshot 2024-07-11 at 11 15 09 AM Screenshot 2024-07-11 at 11 19 48 AM

seems like the api service is working tho: https://api.websitecarbon.com/site?url=https%3A%2F%2Fwww.wholegraindigital.com%2F

@rugor The error you've shown indicates that the websitecarbon service was down at that time. As long as the CarbonBadge is shown in your application, your setup of the CarbonBadge should have worked. Can you confirm it's working for you right now?