解决create-react-app脚手架创建的项目中按需引入ant-design时 报错TypeError: injectBabelPlugin is not a function的问题

React:create-react-app脚手架项目中按需引入ant-design报错TypeError: injectBabelPlugin is not a function

错误形式

运行npm start时报如下错误:
TypeError: injectBabelPlugin is not a function
如下图:
解决create-react-app脚手架创建的项目中按需引入ant-design时 报错TypeError: injectBabelPlugin is not a function的问题

错误原因

好像说是react-scripts 升级到 2.1.2 以后破坏了 react-app-rewired

解决办法

对react-scripts进行降级处理

// 在terminal输入下列命令
npm install react-app-[email protected]2.0.2-next.0

如图:
解决create-react-app脚手架创建的项目中按需引入ant-design时 报错TypeError: injectBabelPlugin is not a function的问题