Reduce size in Ant Design Bundle Size

Wrong-Way

import { Button, DatePicker, message, Alert } from 'antd';

Right Way


import Button from 'antd/es/button';
import Alert from 'antd/es/alert';
import DatePicker from 'antd/es/date-picker';
import message from 'antd/es/message';

Adding individual components will save size.

This is applicable to Lodash, Material UI and similar libraries which support individual export of modules/submodules.

12+yrs exp. JavaScript Expert. Full Stack Expert. React, Nodejs Mongo AWS, Terraform Pulumi. IITian, Open Source. Currently Software Architect @ Prophecy.io

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store