Create React App 5.0.0 发布,零配置创建 App
Create React App 5.0.0 现已发布,这是一个主要版本。Create React App 是由 Facebook 推出的脚手架,基本可以零配置搭建基于 webpack 的 React 开发环境,并内置了热更新等功能。
具体更新内容如下:
Highlights
- webpack 5 (#11201)
- Jest 27 (#11338)
- ESLint 8 (#11375)
- PostCSS 8 (#11121)
- Fast Refresh 改进和 bug 修复 (#11105)
- 支持 Tailwind (#11717)
- 改进的包管理器检测 (#11322)
- 解除了所有的依赖关系,以便与其他工具更好地兼容 (#11474)
- Dropped support for Node 10 and 12
- 不再支持 Node 10 和 12
从 4.0.x 迁移到 5.0.0
在任何尚未 ejected 的已创建项目中,运行:
npm install --save --save-exact react-scripts@5.0.0
或者
yarn add --exact react-scripts@5.0.0
NOTE:如果在升级后遇到错误,你可能需要删除 node_modules 文件夹并通过运行 npm install(或 yarn)重新安装你的依赖。
Breaking Change
reate-react-app- #11322 使用 env var 检测 yarn 或 npm 作为包管理器
babel-preset-react-app,cra-template-typescript,cra-template,create-react-app,eslint-config-react-app,react-app-polyfill,react-dev-utils,react-error-overlay,react-scriptseslint-config-react-app,react-error-overlay,react-scripts- #10761 chore:迁移到 @babel/eslint-parser
react-scripts- #11188 弃用 root level template.json keys
错误修复
完整内容可查看:https://github.com/facebook/create-react-app/releases/tag/v5.0.0