版权声明:Dream_Lees Blog https://blog.csdn.net/qq_41846861/article/details/86561674
React:create-react-app脚手架项目中按需引入ant-design报错TypeError: injectBabelPlugin is not a function
错误形式
运行npm start时报如下错误:
TypeError: injectBabelPlugin is not a function
如下图:
错误原因
应该是react-scripts 升级到 2.1.2 以后破坏了 react-app-rewired
解决办法
对react-scripts进行降级处理
// 在terminal输入下列命令
npm install react-app-rewired@2.0.2-next.0
如图:
完成后在再输入命令npm start
就可以正常运行项目了。