-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade CRACO to v7.1.0 & react-scripts to v5.0.1 #2376
Conversation
To resolve the following error: Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize' It seems that some dependencies which should be hoisted to the top- level of the dependency tree were previously not.
Webpack 5 no longer automatically polyfills many of the Node.js modules. As such, we need to pull them in ourselves.
@@ -1,3 +1,6 @@ | |||
// eslint-disable-next-line @typescript-eslint/no-var-requires |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot use ES6 imports for config files.
'os': require.resolve('os-browserify/browser'), | ||
'stream': require.resolve('stream-browserify'), | ||
'timers': require.resolve('timers-browserify'), | ||
'url': require.resolve('url/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing slash was part of the instructions given by Webpack. I'm not very sure if removing it will cause any errors.
Pull Request Test Coverage Report for Build 4496740579Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
7ebaf50
to
6982c11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
* Update CRACO from v6.4.5 to v7.1.0 * Update react-scripts from v4.0.3 to v5.0.1 * Remove selective dependency resolution of react-error-overlay * Remove duplicate ESLint installation - favour CRA's * Enable old WebAssembly in Webpack 5 * Regenerate dependency tree To resolve the following error: Loading PostCSS "postcss-normalize" plugin failed: Cannot find module 'postcss-normalize' It seems that some dependencies which should be hoisted to the top- level of the dependency tree were previously not. * Force use of React 17 types instead of 18 * Polyfill Node.js core modules Webpack 5 no longer automatically polyfills many of the Node.js modules. As such, we need to pull them in ourselves. * Ignore missing source map warnings for dependencies * Polyfill 'process' for environment variables to work * Polyfill 'buffer' for the application to work in the browser * Move polyfill libraries to dev dependencies * Update test snapshots
Description
We are upgrading
react-scripts
to v5 so that it can be used with Node.js 18. This is because Node.js 16 is reaching end of life this September.Changes:
react-scripts
from v4.0.3 to v5.0.1.react-error-overlay
.react-scripts
being updated. See Fix error & injection of iframe on hot reload #2214 for more information.react-script
's version to prevent conflicts in configuration.syncWebAssembly
option for Webpack 5.yarn.lock
and regenerated it).react-scripts
caused a lot of changes in dependencies. Some of these dependencies need to be hoisted to the top-level of the dependency tree to work, but were not.@types/react
to use v17 instead of v18.node_modules
directory.process
andbuffer
polyfills as plugins.process
is needed for environment variables to work as if they were being used in a Node.js environment (i.e., all of theprocess.env.ENV_VAR
that are being used in the codebase).buffer
is needed for some of our dependencies.Resolves #2313. Fully fixes #2213.
Type of change
How to test
There should be no change in behaviour.