问题遇到的现象和发生背景
使用antd改变自定义主题,我都是根据官网3x版本走的 还是有问题
用代码块功能插入代码,请勿粘贴截图
我的less等版本
"@testing-library/user-event": "^13.5.0",
"antd": "^4.23.6",
"antd-mobile": "^5.24.2",
"babel-plugin-import": "^1.13.5",
"customize-cra": "^1.0.0",
"less": "^4.1.3",
"less-loader": "10.2.0",
"postcss-loader": "6.2.1",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
我的config-overrides.js文件
const { override, fixBabelImports, addLessLoader } = require('customize-cra');
module.exports = override(
fixBabelImports('import', {
libraryName: 'antd',
libraryDirectory: 'es',
// style: 'css',
style:true,
}),
addLessLoader({
lessOptions:{
javascriptEnabled: true,
modifyVars: { '@primary-color': 'green' },
}
}),
);
运行结果及报错内容
ValidationError: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'plugins'.
我的解答思路和尝试过的方法
我查阅了网上相关消息 都说是版本问题,我修改了好几次less-loader与postcss-loader的版本,但是都没有解决
我想要达到的结果
成功运行,修改自定义颜色为绿色