react按需加载ant

246 阅读1分钟

ant按需加载

  1. npm install antd --save
  2. npm run eject抛出config文件夹
  3. 在config文件夹里webpack.config.js的plugins字段添加

["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" // style: true 会加载 less 文件 }]

  1. 完成