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

ReferenceError document is not defined with Nuxt 2.5.0 #1

Closed
aozora opened this issue Mar 23, 2019 · 6 comments
Closed

ReferenceError document is not defined with Nuxt 2.5.0 #1

aozora opened this issue Mar 23, 2019 · 6 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@aozora
Copy link

aozora commented Mar 23, 2019

Hi, I get the following error when using it with Nuxt.js, I also tried by wrapping it within the <no-ssr> but I still got the same error:

ReferenceError: document is not defined
node_modules/vue-lazy-youtube-video/dist/vue-lazy-youtube-video.js:1:7909 
@andrewvasilchuk
Copy link
Owner

andrewvasilchuk commented Apr 5, 2019

Hi, thank you for creating the issue. Sorry, but currently this component does not support SSR.
Maybe, these links can help you:

Also you can add support for SSR. PR's are welcome.

@unr
Copy link

unr commented Dec 6, 2019

If you don't need to render a youtube video for SSR, you can always do it on the client side.

https://nuxtjs.org/api/components-client-only#the-lt-client-only-gt-component


I spoke too soon, haha. This doesn't work sadly.

@unr
Copy link

unr commented Dec 6, 2019

@aozora If you import the component directly, you can use it in SSR fine.

#7

I am using a version of this component with no SASS, and I can now freely import it into my builds.

@andrewvasilchuk andrewvasilchuk self-assigned this Dec 8, 2019
@andrewvasilchuk andrewvasilchuk added the good first issue Good for newcomers label Dec 8, 2019
@andrewvasilchuk
Copy link
Owner

I'm currently in research of separate build for Nuxt.js. Till for that moment you can import component directly:

import LazyYoutubeVideo from 'vue-lazy-youtube-video/src/VueLazyYoutubeVideo.vue'

export default {
  // ...
  components: {
    LazyYoutubeVideo,
  },
  // ...
}

@andrewvasilchuk
Copy link
Owner

andrewvasilchuk commented Dec 9, 2019

@aozora, 1.3.0-beta.1 is now shipped with SSR support. The only drawback is that you have to import component's style explicitly. See this issue. But you can still import component directly, as @unr stated.

Can we close the issue? 🤔

@aozora aozora closed this as completed Dec 9, 2019
@aozora
Copy link
Author

aozora commented Dec 9, 2019

Thank you, I think we can close it now!

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

No branches or pull requests

3 participants