It seems like since version 6.0.4 the package has been shipping without some image folder
./node_modules/swiper/esm/components/core/core-class.js
Module not found: Can't resolve './images/index' in '/path-to-project/node_modules/swiper/esm/components/core
This is a (multiple allowed):
npx create-react-app slider-testyarn add swiperimport React from 'react';
import { Swiper, SwiperSlide } from 'swiper/react';
import SwiperCore from 'swiper';
// Import Swiper styles
import 'swiper/swiper-bundle.css';
export default () => {
return (
<Swiper
spaceBetween={50}
slidesPerView={3}
onSlideChange={() => console.log('slide change')}
onSwiper={(swiper) => console.log(swiper)}
>
<SwiperSlide>Slide 1</SwiperSlide>
<SwiperSlide>Slide 2</SwiperSlide>
<SwiperSlide>Slide 3</SwiperSlide>
<SwiperSlide>Slide 4</SwiperSlide>
...
</Swiper>
);
};
yarn start and expect to see the error message in the screenThanks for your awesome work! 馃憦
I've met the same issue. Weirdly, using npm install works fine, the images folder is there, while yarn does not.
It turns out to be the .yarnclean file, which contains a line images by default, if you are using yarn install, it automatically cleans the images folder. Just delete the line.
Thanks @bruceCzK ! Closing as not related to Swiper
Thanks @bruceCzK !!!!
Most helpful comment
It turns out to be the
.yarncleanfile, which contains a lineimagesby default, if you are using yarn install, it automatically cleans theimagesfolder. Just delete the line.