kidjp85 / react-id-swiper

A library to use idangerous Swiper as a ReactJs component which allows Swiper's modules custom build
https://react-id-swiper.ashernguyen.site/
MIT License
1.49k stars 154 forks source link

Tree shaking? #460

Open Danetag opened 4 years ago

Danetag commented 4 years ago

Hey there!

Right now, when building chunks, the swiper library is fully built, which results in a huge chunk.

Screen Shot 2020-08-05 at 10 57 53 AM

Is there anything we can do in the webpack configuration to tree shake this?

Thanks!

johnmagbag1995 commented 4 years ago

This works for me https://react-id-swiper.ashernguyen.site/doc/custom-build

Danetag commented 4 years ago

The provides configuration (regex) doesn't work (it's not valid)

 module: {
    rules: [
      {
        exclude: [/node_modules/(?!(swiper|dom7)/).*/, /.test.js(x)?$/],
        test: /.js(x)?$/,
        use: [{ loader: 'babel-loader' }],
      }
    ],
  }

What exactly is the goal here? To exclude from the babel transpilation swiper and dom7 files?