create-react-app demo
创建demo脚手架
npm run eject
react的webpack配置默认不可显,该命令可显示config
npm i babel-plugin-import --save-dev
安装babel按需加载依赖
package.json添加下列配置
"plugins": [
["import",{"libraryName": "antd","libraryDirectory": "es","style": "css"}]
]
使用组件可直接引入 css会按需加载
import { Button } from 'antd'