1.安装antd和 babel-plugin-import
cnpm install antd
cnpm install babel-plugin-import
2.在package.json里配置babel
"babel": {
"presets": [
"react-app"
],
//增加下面这些代码
"plugins": [
[
"import",
{
"libraryName": "antd",
"libraryDirectory": "es",
"style": "css"
}
]
]
}