I set a project with NextJS, Tailwind CSS and Swiper JS.
When I run Yarn Dev I can successfully display my Swiper Slider without any error
However, once I built the project and run Start I am facing a broken slider with no navigation but I can still swipe but I get a blank
To reproduce just set a NextJS project with Tailwind config and Swiper slider. Create a file in pages folder with this samples code
// import Swiper core and required modules
import SwiperCore, { Navigation, Pagination, Scrollbar, A11y } from 'swiper'
import Layout from '@modules/Layout'
import { Swiper, SwiperSlide } from 'swiper/react'
// install Swiper modules
SwiperCore.use([Navigation, Pagination, Scrollbar, A11y])
const Slider = () => {
return (
<div className='container'>
<Swiper
spaceBetween={50}
slidesPerView={1}
navigation
pagination={{ clickable: true }}
onSwiper={(swiper) => console.log(swiper)}
onSlideChange={() => console.log('slide change')}
>
<SwiperSlide>
<div className='h-96 w-50 bg-red'>Slide 1</div>
</SwiperSlide>
<SwiperSlide>
<div className='h-96 w-50 bg-blue'>Slide 2</div>
</SwiperSlide>
<SwiperSlide>
<div className='h-96 w-50 bg-orange'>Slide 3</div>
</SwiperSlide>
<SwiperSlide>
<div className='h-96 w-50 bg-green'>Slide 4</div>
</SwiperSlide>
</Swiper>
</div>
)
}
export default Slider
- Swiper Version: 6.5.6.
- Platform/Target and Browser Versions: CHROME

