ant design - huge imports

后端 未结 7 1284
北恋
北恋 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:21

    Those few components are certainly not 1.2M together. Looks like you are importing the whole library when you only need a few components.

    To get antd to load only the needed modules you should use babel-plugin-import. Check your console log for the "You are using a whole package of antd" warning described at that link.

    Check out the docs for Create-React-App for how to implement it if you're using CRA.

提交回复
热议问题