yarn add antd
yarn add @ant-design/icons
yarn add moment

// 配置andt 主题
yarn add @craco/craco
// 修改配置命令
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject"
},

yarn add craco-less

scr 同级目录创建 craco.config.js
const CracoLessPlugin = require('craco-less');
module.exports = {
plugins:[
{
plugin:CracoLessPlugin,
options:{
lessLoaderOptions:{
lessOptions:{
modifyVars:{'@primary-color':"#1da57a"},
javascriptEnabled:true
}
}
}
}
]
}
// 引入 antd less
import 'antd/dist/antd.less';
重启项目 配置成功


// 配置别名
const CracoLessPlugin = require('craco-less');
const path = require('path');
const resolve = dir => path.resolve(__dirname,dir);

module.exports = {
plugins:[
{
plugin:CracoLessPlugin,
options:{
lessLoaderOptions:{
lessOptions:{
modifyVars:{'@primary-color':"#1da57a"}, // 配置主题颜色
javascriptEnabled:true
}
}
}
}
],
webpack:{
alias:{
"@":resolve("src"),
"components":resolve("src/components"),
}
}
}