Import {Button} from 'antd' sub-module loading, how to do it

when import {Button} from "antd", is packaged, only button is packaged and loaded in modules. How do you do that?


is processed through babel-plugin-import configuration.

{
  "plugins": [
    ["import", {
      "libraryName": "antd",
      "libraryDirectory": "es",
      "style": "css"
    }]
  ]
}

is equivalent to

import Button from 'antd/es/button';
import 'antd/es/button/style/css';

you can check the relevant files under node_modules/antd for yourself.

Menu