Create React App v4.0.0 release a major update with several new features, including support for Fast Refresh!
The New Version Includes New Features and supports are list below:
Create React App v4 Highlights
- Fast Refresh
- React 17 support includes the new JSX transform
- TypeScript 4 support
- New ESLint 7 Rules : New Jest and React Testing Library rules
- Jest 26
- PWA/workbox improvements
1: Switch to the Workbox InjectManifest plugin
2: Now its own template so it can be released independently - Web Vitals support
Migrating from 3.4.x to 4.0.0
You can update the react version Inside any created project that has not been ejected, run:
npm install --save --save-exact [email protected]
OR
yarn add --exact [email protected]
Note:
you may have to delete your node_modules folder and reinstall your dependencies by running yarn (or npm install) if you encounter errors after upgrading.
Breaking Changes
[email protected] contains a number of breaking changes. We expect that they won’t affect every user, but they recommend us to look over this section to see if something is relevant to you. If we missed something, you can file a new issue over repository.
ESLint
It has upgraded to ESLint 7 and added many new rules including some for Jest 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.
Jest
It has upgraded to Jest 26 and now set resetMocks
to true
by default in the Jest config.
Service workers
It has switched to the Workbox InjectManifest
plugin and moved the PWA templates into their own repository.
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
.
Dropped Node 8 support
Node 8 reached End-of-Life at the end of 2019 and is no longer supported.
Fix dotenv file loading order
It has changed the loading order of env
files to match the dotenv
specification.
Links
Release Date: October 23, 2020
Detailed Change Log: Changelog in details
Change Log: Create React App 4.0.0