react craco 配置antd的按需引入样式

yarn add babel-plugin-import 或者 npm install babel-plugin-import

//在craco.config,.js里加上
babel:{  
    plugins: [
      ["@babel/plugin-proposal-decorators", { legacy: true }],  //装饰器
      [   
        "import", 
        {
          "libraryName": "antd",
          "libraryDirectory": "es",
           "style": true 
         }
     ]
    ]
 },

posted @ 2021-12-30 17:01  柯宝宝智商感人  阅读(324)  评论(0编辑  收藏  举报