6

We have a react native application with react-native-web used for the web bundle. The problem is the react-native-web bundle is 827kb in the final bundle and is the major part of the build.

We are not using all the modules in the package yet the unused are not treeshaken. Any tips to reduce the bundle size?

Rules

  {
    test: /\.(js|jsx|ts|tsx)$/,
    loader: 'babel-loader',
    options: {
      cacheDirectory: true,
      plugins: ['react-native-web']
    },
    exclude: /node_modules/
  },

Prod config :

module.exports = merge(baseConfig, {
  mode: 'production',
  plugins: [new TerserPlugin()]
})
Vishnu Mohan
  • 111
  • 5

0 Answers0