Sage 10 and installation on CSS loader

Hi.

I am trying to install the plugin Swiper into my Sage 10 theme, but I am meeting an issue.

After installing it via NPM, the issue come when I call the following line in my app.js :
import ‘swiper/css’;,

I have the following message :
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

I understand that I need to install a css loader but I don’t know which one, and how to it.
Is it possible to have some help?

Thanks.

I share with you our configuration.

# package.json
[...]
"swiper": "^8.0.5",
[...]
# resources/scripts/app.js
import Swiper, {Autoplay, Navigation, Pagination} from 'swiper';
import 'swiper/css';
import 'swiper/css/autoplay';
import 'swiper/css/navigation';
import 'swiper/css/pagination';

We have imported only some modules, as you can see, but you could import the whole bundle if you need it.

Hope it helps.

3 Likes