You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although Swiper has SvelteKit SSR instructions, it only works for basic usage – without Navigation, Pagination or Autoplay.
There are several issues about this since Dec'20 [#3961/#4404/#4574/#4590], but all of them failed to bring a minimal reproduction sandbox – so I am creating this issue in order to provide a bootstrap environment.
2. I installed swiper as dev dependency [as mentioned here] and tried to lazy load each component individually, but to be honest I have no clue if that's right.
I tried for days to get this running and finally have a work around that passes dev and build, but unfortunately without the Swiper Svelte components...
<script>import{onMount}from'svelte';importSwiperfrom'swiper';importSwiperCore,{Navigation}from'swiper';/* importing swiper/core throws error in build */letcontainer,swiper,next,prev;onMount(()=>{SwiperCore.use([Navigation]);swiper=newSwiper(container,{slidesPerView: 2,navigation: {nextEl: next,prevEl: prev,}});return()=>{swiper.destroy();}});exportletslides=[];</script><divclass="swiper-container" bind:this={container}><divclass="swiper-wrapper">
{#each slides as slide}
<divclass="swiper-slide"><!-- slide content or slot --></div>
{/each}
</div><divclass="swiper-button-next" bind:this={next}></div><divclass="swiper-button-prev" bind:this={prev}></div></div>
Although Swiper has SvelteKit SSR instructions, it only works for basic usage – without Navigation, Pagination or Autoplay.
There are several issues about this since Dec'20 [#3961/#4404/#4574/#4590], but all of them failed to bring a minimal reproduction sandbox – so I am creating this issue in order to provide a bootstrap environment.
Expected Behavior
Navigation, Pagination and Autoplay working with SvelteKit SSR.
Actual Behavior
Swiper ignored Navigation, Pagination and Autoplay.
Have you tried...?
1. I tried to run
SwiperCore.use()
on client side, but nothing changes.2. I installed
swiper
as dev dependency [as mentioned here] and tried to lazy load each component individually, but to be honest I have no clue if that's right.Above approach works for svelte-carousel, as mentioned here.
The text was updated successfully, but these errors were encountered: