swiper: Swiper4 seems cannot be compressed by webpack UglifyJs plugin
Error below occurred when I tried to compress swiper4 via Webpack3 build-in UglifyJs plugin).
ERROR in scripts/lion_6a64ded940eb84148718.js from UglifyJs
Unexpected token: name (i) [scripts/lion_6a64ded940eb84148718.js:6536,6]
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 16 (4 by maintainers)
Commits related to this issue
- change import path because see https://github.com/nolimits4web/Swiper/issues/2206 — committed to akichim21/react-id-swiper by akichim21 7 years ago
- update swiper 4.0.2 & fix propTypes (#71) * update swiper 4.0.2 & fix propTypes * change import path because see https://github.com/nolimits4web/Swiper/issues/2206 — committed to kidjp85/react-id-swiper by akichim21 7 years ago
You are probably including ES-next version of swiper. If you use it with imports you need to use something like
babel-loader
or import correct version:import Swiper from 'swiper/dist/js/swiper.js';
I was using just
import Swiper from 'swiper';
and I can confirm thatimport Swiper from 'swiper/dist/js/swiper.js';
solved the issue for me.I got the same issue using Swiper 4 and I couldn’t figure out how to fix it. Using
babel-loader
throws this error:3.4.2 version is ok Webpack build uglify