安装antd
yarn add antd
安装 @craco/craco 替换 react-scripts ,项目根目录新建craco.config.js覆盖默认配置
yarn add @craco/craco
craco.config.js
/*
* @Author : ny
* @Date : 2023-01-11 09:17:45
* @Description : craco配置
* @FilePath : /my-app/craco.config.js
*/
module.exports = {
...
};
修改项目启动、打包、测试命令
/* package.json */
"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test",
+ "start": "craco start",
+ "build": "craco build",
+ "test": "craco test",
}
文章介绍了如何用yarn添加antd库以及@craco/craco来替代react-scripts。创建了craco.config.js文件进行自定义配置,并修改package.json中的脚本命令以使用craco进行项目启动、构建和测试。
664

被折叠的 条评论
为什么被折叠?



