日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

react引入antd按需加載警告“You are using a whole package of antd, please use...“

作者:騎上我心愛的小摩托 更新時間: 2022-03-03 編程語言
  1. react引入antd后報出黃色警告You are using a whole package of antd, please use https://www.npmjs.com/package/babel-plugin-import

  2. 此時需要引入babel-plugin-import按需加載

npm install babel-plugin-import --save-dev
  1. 在根目錄下新建文件babelrc
    在這里插入圖片描述
{
  "plugins": [
    ["import", { "libraryName": "antd", "style": "css" }]
  ]
}
  1. 重啟項目,警告消失

原文鏈接:https://blog.csdn.net/cxwtsh123/article/details/113241856

欄目分類
最近更新