I'm attempting to utilize the swiper library within my angular2 + npm application, but I'm encountering an error during the build process.
The specific error message is:
ERROR in vendor.95f9dda80938ded736ad.bundle.js from UglifyJs
Unexpected token: name (class_SwiperClass) [vendor.95f9dda80938ded736ad.bundle.js:16626,6]
I have added the swiper package to my package.json and implemented it within my component like so:
import Swiper from 'swiper/src/components/core/core-class';
ngAfterViewInit() {
let mySwiper : any = new Swiper('swiper-container', {
autoplay: 1000,
autoplayDisableOnInteraction : false,
speed: 400,
spaceBetween: 0,
pagination : ".swiper-pagination"
});
}
Below is a snippet of my angular-cli configuration:
{
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"prefix": "app",
"styles": [
"../node_modules/swiper/dist/css/swiper.css"
],
"scripts": [
"../node_modules/swiper/dist/js/swiper.js"
]
}
]
}