v4.0.0
4.0.0 (2020-10-23)
Create React App 4.0 is a major release with several new features, including support for Fast Refresh!
Thanks to all the maintainers and contributors who worked so hard on this release! :raised_hands:
Highlights
- Fast Refresh #8582
- React 17 support
- New JSX transform #9645
- TypeScript 4 support #9734
- ESLint 7 #8978
- New Jest and React Testing Library rules #8963
- Jest 26 #8955
- PWA/workbox improvements
- Switch to the Workbox InjectManifest plugin #9205
- Now its own template so it can be released independently
- Web Vitals support #9116
Migrating from 3.4.x to 4.0.0
Inside any created project that has not been ejected, run:
npm install --save --save-exact react-scripts@4.0.0
or
yarn add --exact react-scripts@4.0.0
NOTE: You may need to delete your node_modules folder and reinstall your dependencies by running yarn (or npm install) if you encounter errors after upgrading.
If you previously ejected but now want to upgrade, one common solution is to find the commits where you ejected (and any subsequent commits changing the configuration), revert them, upgrade, and later optionally eject again. It’s also possible that the feature you ejected for is now supported out of the box.
Breaking Changes
Like any major release, react-scripts@4.0.0 contains a number of breaking changes. We expect that they won't affect every user, but we recommend you look over this section to see if something is relevant to you. If we missed something, please file a new issue.
ESLint
We've 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. We've 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
We've upgraded to Jest 26 and now set resetMocks to true by default in the Jest config.
Service workers
We've switched to the Workbox InjectManifest plugin and moved the PWA templates into their own repository.
Removed typescript flag and NODE_PATH support
We've removed the deprecated typescript flag when creating a new app. Use --template typescript instead. We've also dropped deprecated NODE_PATH flag as this has been replaced by setting the base path in jsconfig.json.
Fix dotenv file loading order
We've changed the loading order of env files to match the dotenv specification. See #9037 for more details.
Dropped Node 8 support
Node 8 reached End-of-Life at the end of 2019 and is no longer supported.
Detailed Changelog
:rocket: New Feature
eslint-config-react-app,react-error-overlay,react-scripts- #8963 feat(eslint-config-react-app): Add jest & testing-library rules (@MichaelDeBoey)
react-scripts
:boom: Breaking Change
eslint-config-react-app,react-error-overlay,react-scripts- #8963 feat(eslint-config-react-app): Add jest & testing-library rules (@MichaelDeBoey)
- #8978 Support ESLint 7.x (@MichaelDeBoey)
cra-template-typescript,cra-template,eslint-config-react-app,react-error-overlay,react-scriptseslint-config-react-app- #9401 fix: remove deprecated rule (@ljosberinn)
:bug: Bug Fix
react-scripts- #9805 Fix refreshOverlayInterop module scope error (@ianschmitz)
- #9037 Fix dotenv file loading order (@Timer)
- #8700 Skip stdin resuming to support lerna parallel (@hieuxlu)
- #8845 Do not check for interactive session to shut down dev server (@jeremywadsack)
- #8768 Add .cjs and .mjs files support to test runner ()
:nail_care: Enhancement
react-scripts- #9734 Use new JSX setting with TypeScript 4.1.0 (@iansu)
- #8638 Support source maps for scss in dev environments (@MKorostoff)
- #8834 Don't use webpack multi entry unnecessarily (@sebmarkbage)
babel-preset-react-app,eslint-config-react-app,react-scriptscra-template- #9853 feat: remove unused React imports ()
:memo: Documentation
- Other
- #9728 Upgrade Docusaurus to latest version (@lex111)
- #9630 Emphasise that Next.js is capable of SSG (@liamness)
- #9073 Update running-tests.md (@MichaelDeBoey)
- #9560 Update Vercel deployment documentation (@timothyis)
- #9380 Update running-tests.md (@andycanderson)
:house: Internal
eslint-config-react-app- #9670 fix(eslint-config-react-app): Make eslint-plugin-jest an optional peerDependency (@MichaelDeBoey)
- Other
- #9258 fix: Fix azure-pipelines' endOfLine (@MichaelDeBoey)
- #9102 Replace Spectrum links with GitHub Discussions (@iansu)
- #8656 Bump acorn from 6.4.0 to 6.4.1 in /docusaurus/website (@dependabot[bot])
- #8749 Specify what files are served form a bare local copy ()
:hammer: Underlying Tools
react-scripts- #9865 Pass JSX runtime setting to Babel preset in Jest config (@iansu)
- #9841 Bump resolve-url-loader version (@johannespfeiffer)
- #9348 Upgrade refresh plugin (@ianschmitz)
- #8891 Bump style-loader to 1.2.1 (@chybisov)
react-error-overlay,react-scripts- #9863 Upgrade to React 17 ()
Committers: 63
- Adam Charron (@charrondev)
- Alex Krolick (@alexkrolick)
- Alexey Pyltsyn (@lex111)
- Andrey Sitnik (@ai)
- Andy C (@andycanderson)
- Anuraag Agrawal (@anuraaga)
- Braedon Gough (@braedongough)
- Brian Morearty (@BMorearty)
- Brody McKee (@mrmckeb)
- Burke Holland (@burkeholland)