Closed RonRofe closed 2 years ago
What dependencies/devDependencies do you have listed in your package.json
file?
For the stylelint-webpack-plugin
, it appears that the last version of that package to support webpack 4 was version 2.2.2. If you've installed version 3+, it may be pulling in webpack 5 with it. Please try downgrading styleling-webpack-plugin to version 2.2.2
.
For the
stylelint-webpack-plugin
, it appears that the last version of that package to support webpack 4 was version 2.2.2. If you've installed version 3+, it may be pulling in webpack 5 with it. Please try downgrading styleling-webpack-plugin to version2.2.2
.
@dawnmist Why do I need to support webpack version 4 instead of 5?
Because from your original error messages, react-scripts
(which holds all the create-react-app
build scripts) requires you to use webpack 4, as stated here:
project | The react-scripts package provided by Create React App requires a dependency:
project |
project | "webpack": "4.44.2"
The entire error message you provided is react-scripts
from create-react-app
telling you that it has detected the wrong version of webpack installed - it needs webpack 4 and found webpack 5 instead. It then gives you an environment variable you can use to skip checking the webpack version, but warns that the build scripts may break if you use the environment variable to override the "preflight" version check for webpack in react-scripts
. It also tells you some possible debugging steps you could take for trying to get the correct version installed if the installation of webpack 5 had been by mistake.
Please note: this error message comes from create-react-app
. It is not caused by react-app-rewired in any way, it is caused by the other node_modules packages you have installed, most likely one or more plugins that depend on webpack 5. I commented on the stylelint plugin because it was the only plugin listed anywhere in the information you provided and on checking the release information for that plugin on its github page I could see that the plugin had dropped support for webpack 4 with version 3.0.0 so it may have been a way that webpack 5 ended up being accidentally installed.
You will need to check any other webpack plugins you have also installed for the same issue, and downgrade any that no longer support webpack 4 to the last version that did support webpack 4.
Have the same issue. Guys, Webpack 5 is the norm in the end of 2021, please update the package to reflect it. I see that react-app-rewired requires old versions of html-webpack-plugin@4.5.0, optimize-css-assets-webpack-plugin@5.0.4, webpack-manifest-plugin@2.2.0 , terser-webpack-plugin@1.4.5 , workbox-webpack-plugin@5.1.4
all of which requirewebpack@4.44.2
, but all other packages are require for webpack@5.64.4
. Updating these dependencies in react-app-rewired will solve the issue.
@christopanayotovvia All of the dependencies you have highlighted come from Create React App's react-scripts
package, not from react-app-rewired
itself. I'd suggest that you make your demands to the Create React App project upstream, as we do not have control over what packages they use.
This is the dependencies that react-app-rewired
requires: https://github.com/timarney/react-app-rewired/blob/b7b4bea299c9fe67f77b736d10d1f9482dea6459/package.json#L18-L26
Closing --- as it doesn't seem to be a issue with this repo
I have installed the
react-app-rewired
package in my project. Then I changed mystart
script toreact-app-rewired start
.Using
npm start
, I'm receiving the following from the compiler:My
config-overrides.js
file:Styleint in
package.json
:Help?