如何将使用create-react-app构建的React项目升级到下一个create-react-app版本?

问题描述:

我有一个使用 create-react-app 1.5构建的React项目。我想为我的React项目获得 create-react-app 2.0的功能。

I have a React project built with create-react-app 1.5. I would like to get the features of create-react-app 2.0 for my React project.

我可以喜欢这样使用: https://github.com/facebook/create-react- app / pull / 3909

Specifically I would like to use this: https://github.com/facebook/create-react-app/pull/3909

基本上,要升级 create-react-app 项目,您需要做的就是将反应脚本模块更新到最新版本,并更新您的应用程序以使其兼容反应脚本的任何重大更改。

Basically, to upgrade a create-react-app project, all you need to do is update the react-scripts module to the latest version and update your app to be compatible with any breaking changes in react-scripts.

运行 纱线升级-最新的反应脚本 ,重新构建您的应用,一切都应该更多-或更少的工作,除非有任何重大更改。

Run yarn upgrade --latest react-scripts, rebuild your app, and everything should more-or-less work, barring any breaking changes.