maoberlehner / vue-lazy-hydration

Lazy Hydration of Server-Side Rendered Vue.js Components
MIT License
1.19k stars 52 forks source link

hydrateWhenVisible - chunk loading is not lazy in nuxt static mode #86

Closed Velikolay closed 3 years ago

Velikolay commented 3 years ago

Heya! Thanks for the great library. Is this supposed to work with nuxt static gen? My expectation is that the chunk will only be downloaded when the component becomes visible, but it's pulled on initial page load which is kinda upsetting. Same happened with hydrateNever. The hydration aspect of it works as expected though. Am i doing something wrong? Here's code:

components: {
   ...
   CustomSwiper: hydrateWhenVisible(() => import(/* webpackChunkName: 'swiper' */ '~/components/shared/CustomSwiper')),
}

Thanks a ton!

Velikolay commented 3 years ago

Found the answer here: https://github.com/maoberlehner/vue-lazy-hydration/issues/62