G
G
GIRU2020-01-20 20:20:29
JavaScript
GIRU, 2020-01-20 20:20:29

How to properly include the swiper slider module in webpack4?

Good afternoon! I'm trying to make a slider but I can't figure out how to connect it correctly. I use swiper, installed it in node modules, imported it, but when I call it, it gives an error that there is no such function. I wrapped the calling code in

// SCSS
import './assets/scss/main.scss'

import 'bootstrap'
import 'bootstrap/dist/css/bootstrap.min.css';


// CSS (example)
import 'Swiper'


$(document).ready(function () {
    let mySwiper = new Swiper('.js-news-slider', {
        speed: 400,
        spaceBetween: 100
    });
    
});
but it did not help. Please tell me what is my mistake? here is the assembly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sybear, 2020-01-21
@vadik007

import Swiper from 'swiper' ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question