nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.41k stars 862 forks source link

SSR broken #823

Open jshimkoski opened 3 years ago

jshimkoski commented 3 years ago

V-calendar should support SSR.

I see in your vue.config.js file you have extractCSS set to false. This is the primary reason SSR support is broken (if you extract the CSS, the document not found error will likely go away, this is a shortcoming of Vue-cli).

Would it be possible to have two different builds? One with extractCSS set to false, and another with extractCSS set to true?

That way, you could have the current version and an SSR compatible build as well.

mrleblanc101 commented 3 years ago

You can wrap v-calendar in a <client-only> tag

jshimkoski commented 3 years ago

You can wrap v-calendar in a <client-only> tag

That is more of a workaround than a clean solution.

  1. Depending on the developer's environment (maybe they are using a custom SSR build, you never know), <client-only> is not guaranteed to exist, which in turn prompts them to have to include an additional dependency.
  2. Any time v-calendar is wrapped by a <client-only> tag, the user will see pop-in on page load.
  3. A developer consuming an external component should not have to worry about using a workaround to use a component whether in client-only or SSR mode.

Yes, we all typically develop within guard rails, and that includes adhering to what is required by a third party component. However, when the solution to this issue is pretty straightforward, it eliminates all of the workarounds, and it makes v-calendar more robust at the same time, doesn't that make it worth it?

brocard commented 1 year ago

And what about this?

ReaganM02 commented 1 year ago

And what about this?

I tested it and it seems working for me. I'll use it for my project. If there are issues, I'll comment here

Here is an example. https://stackblitz.com/edit/nuxt-starter-rf7flv?file=app.vue

santarone commented 1 year ago

And what about this?

I tested it and it seems working for me. I'll use it for my project. If there are issues, I'll comment here

Here is an example. https://stackblitz.com/edit/nuxt-starter-rf7flv?file=app.vue

Is v-date-picker available in this way? Data binding via attributes works exactly. However, the selected date cannot be imported.

officialpiyush commented 1 year ago

is there any progress on supporting SSR natively through the package?

runxc1 commented 1 month ago

I have a custom SSR scenario (so no client-only) and am wondering if the library now supports ssr?

mrleblanc101 commented 1 month ago

@runxc1 You can install the client-only component

runxc1 commented 1 month ago

I ended up having to go with another library as the client-only library isn't an option, I've ran into some issues with it.