Create React App v4.0.0版本发布了一个重大更新,其中包含几个新功能,包括对Fast Refresh的支持!
下面列出了包括新功能和支持的新版本:
创建React App v4亮点
- 快速刷新
- React 17支持包括新的JSX转换
- TypeScript 4支持
- 新的ESLint 7规则:新的Jest和React Testing Library规则
- 笑话26
- PWA /工作箱改进
1:切换到Workbox InjectManifest插件
2:现在有了自己的模板,因此可以独立发布 - 网络生命支持
从3.4.x迁移到4.0.0
您可以在尚未弹出的任何已创建项目中更新react版本,运行:
npm install --save --save-exact [电子邮件 protected]
要么
yarn add --exact [电子邮件 protected]
注意:
您可能需要删除您的 node_modules 文件夹,如果升级后遇到错误,请通过运行yarn(或npm install)重新安装依赖项。
重大变化
[电子邮件 protected] 包含许多重大更改。我们希望它们不会影响每个用户,但他们建议我们仔细阅读本节,以了解是否有与您相关的内容。如果我们错过了什么,您可以通过存储库提出新的问题。
ESLint
It has upgraded to ESLint 7 and added many new rules including some for 笑话 and React Testing Library as well as the import/no-anonymous-default-export
rule. It has also upgraded eslint-plugin-hooks
to version 4.0.0 and removed the EXTEND_ESLINT
flag as it is no longer required to customize the ESLint config.
笑话
It has upgraded to 笑话26 and now set resetMocks
to true
by 默认 in the 笑话 config.
服务人员
It has switched to the Workbox InjectManifest
plugin and moved the PWA templates into their own 资料库.
Removed typescript
flag and NODE_PATH
support
It has removed the deprecated typescript flag when creating a new app. Use --template
typescript instead. It also dropped deprecated NODE_PATH
flag as this has been replaced by setting the base path in jsconfig.json
.
放弃对节点8的支持
Node 8于2019年底达到生命周期终止,不再受支持。
修复dotenv文件加载顺序
It has changed the loading order of env
files to match the dotenv
specification.
链接
发布日期: 2020年10月23日
详细的更改日志: 变更日志中的详细信息
变更记录: 创建React App 4.0.0