swiper

Open full view…

IE10 "Object doesn't support property or method 'use'" with es modules / webpack

joereed
Thu, 28 Dec 2017 12:15:00 GMT

IE10 (and, incidentally, IE9- though I know it's not supported) gives me _"Object doesn't support property or method 'use'"_ error. I am using swiper esm, with webpack and babel and it's compiling as expected on modern browsers. The code breaks when Swiper runs `Swiper.use` on the core modules, so even using the full fat Swiper instance (*not* modules), this still error still occurs. Seems like it relates to how webpack is compiling the library, but any other ideas? *webpack.config.json* ``` module: { rules: [ { test: /\.js$/, exclude: [ /node_modules\/(?!(dom7|swiper)\/).*/, ], use: { loader: 'babel-loader', options: { presets: [ [ 'env', { targets: { browsers: ['ie 10'], }, useBuiltIns: true, loose: true, }, ], ], }, }, }, ], }, ```

joereed
Thu, 28 Dec 2017 12:27:40 GMT

Didn't realise that there are a couple of Github issues relating to this: https://github.com/nolimits4web/Swiper/issues/2383 suggests using `proto-polyfill` https://www.npmjs.com/package/proto-polyfill, which seems to have fixed it for me too.