ant design - huge imports

后端 未结 7 1261
北恋
北恋 2020-12-24 11:56

I\'m using ant design library for my react application.

And I\'ve faced with huge imports, that hurts my bundle (currently 1.1 mb in minified version because of ant-

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-24 12:20

    Looking at the docs https://ant.design/docs/react/getting-started#Import-on-Demand there is a recommedation to import individual components on demand. So, you can try and replace

    import { Button} from 'antd' 
    

    with

    import Button from 'antd/lib/button'
    

提交回复
热议问题