ManukMinasyan / vue-functional-calendar

Vue.js Functional Calendar | Component/Package
https://vue-functional-calendar.now.sh/
MIT License
473 stars 85 forks source link

SSR compatibility #36

Closed sebastianjung closed 4 years ago

sebastianjung commented 4 years ago

Hey thanks for contributing this plugin to the community.

Would it be possible to add SSR Support for like Nuxt for example?

Problem is, that its looking for a window object which is not available on SSR:

"window is not defined"

Great Plugin though!

sebastianjung commented 4 years ago

Catching those 'window' Objects withif (typeof window !== 'undefined') already helped for me though i am not sure if that is the right way to do it.

image

image

ManukMinasyan commented 4 years ago

Hey @sebastianjung. Your solution is correct. Thanks

TitanFighter commented 3 years ago

Simple way:

  components: {
    ...
    FunctionalCalendar: () => process.client ? import('vue-functional-calendar/src/components/FunctionalCalendar.vue') : null,
    ...
  },