@ant-design. Why are all icons added to the bundle?

Viewed 271

I don't understand why all the icons are in the bundle. Even if I only use the button from "antd" import { Button } from 'antd';

  • @ant-design/icons-svg/es/asn - 740kb
  • @ant-design/icons/es/icons - 470kb

webpack-bundle-analyzer.png

How can this be fixed?

module.exports = {
  presets: ['@babel/preset-react', '@babel/preset-env'],
  plugins: [
    [
      'import',
      {
        libraryName: 'antd',
        libraryDirectory: 'es',
        style: true,
      },
      'antd',
    ],
  ],
};
0 Answers
Related