Importing datepicker issue

Hi All,

Trying to install this component/plugin

I keep getting the error “ReferenceError: document is not defined” which has to do with it not being compatible with SSR.

There are notes about this below but this doesn’t help because as soon as I add the import line it crashes before even getting to the “isServer” part.

https://docs.vuestorefront.io/guide/core-themes/plugins.html

Hi,
Did you wrap the component with no-ssr?

<no-ssr>
  <example-component />
</no-ssr>
<script>
import NoSSR from 'vue-no-ssr'
export default {
  components: {
    'no-ssr': NoSSR
  }
}
</script>

Hi,

I had the same problem and wrapping in component did not resolved the issue. have you any other magic tricks?

Thank you a lot,
K

Hi,

The plugin probably needs to be lazy loaded. For example, have a look at the Newsletter and ProductSlider components and how they import NewsletterPopup and the Carousel components respectively.

There’s also a nice article about it by Vue Storefront’s Filip Rakowski

I hope it helps

2 Likes

Thank you so much @grimasod , I’ll try as soon as I finish the current task and i will update the thread.

tnx again!

It works! Thank you so much!

1 Like