vue-youtube / docs

Documentation for VueYoutube
https://vue-youtube.github.io/docs/
MIT License
6 stars 0 forks source link

Nuxt 3 integration #2

Closed I-NOZex closed 1 year ago

I-NOZex commented 1 year ago

Hi, trying to integrate this plugin with NUXT 3, I created this plugin:

import { createManager } from '@vue-youtube/core';

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

But I get a Nuxt error:

500

document is not defined

at Object.install (./node_modules/@vue-youtube/core/dist/index.js:12:29)
at Object.use (./node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:4377:28)
at ./plugins/youtube.js:7:12
at fn (./node_modules/nuxt/dist/app/nuxt.mjs:151:27)
at Object.callAsync (./node_modules/unctx/dist/index.mjs:49:19)
at callWithNuxt (./node_modules/nuxt/dist/app/nuxt.mjs:153:23)
at applyPlugin (./node_modules/nuxt/dist/app/nuxt.mjs:97:29)
at Module.applyPlugins (./node_modules/nuxt/dist/app/nuxt.mjs:107:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
I-NOZex commented 1 year ago

For reference: the nuxt plugin needs to be marked as client only, and the youtube-iframe component wrapped with <ClientOnly>

Techassi commented 1 year ago

Did you make it work? Because there is an open issue over at vue-youtube/vue-youtube#4. I was unable to make it work because of multiple errors.

I-NOZex commented 1 year ago

@Techassi yes its all working now with that change I mention