Binaryify/vue-custom-scrollbar

Support SSR

favoyang opened this issue · 2 comments

vue-custom-scrollbar is awesome, but it doesn't play well with SSR. If you import vue-custom-scrollbar directly it will break SSR because of the reference of document object.

As a workaround, I write a simple wrapper to disable it for SSR.

<!-- wrap vue-custom-scrollbar for SSR -->
<template>
  <component :is="scrollbar" v-if="scrollbar" v-bind="$attrs">
    <slot></slot>
  </component>
</template>

<script>
export default {
  computed: {
    scrollbar() {
      if (!this.$isServer)
        return () => import('vue-custom-scrollbar');
      return null;
    }
  }
};
</script>

However, it could be a better solution here.

webpack bundle issues

 css: { extract: false }

I just disabled that and release a new version, but need import css now

import "vue-custom-scrollbar/dist/vueScrollbar.css"

Thank you!