I have an existing old react application, created with create-react-app and ejected with react-app-rewired. I'm updating the deprecated dependencies. I've already updated react-scripts to the current version (4.0.3) and everything works fine. But I need to update the style-loader lib, and this new version requires webpack 5.
The current react-scripts version is using webpack 4:
> npm ls webpack
my-app@0.1.0
└─┬ react-scripts@4.0.3
└── webpack@4.44.2
I found a project named webpack-5-react-script: https://www.npmjs.com/package/webpack-5-react-scripts. It seems what I need, but as my project was ejected using react-app-rewired a long time ago, I get this error when I run npm start:
Error: Cannot find module 'react-scripts/package.json'
Require stack:
- /home/.../my-app/node_modules/react-app-rewired/scripts/utils/paths.js
- /home/../my-app/node_modules/react-app-rewired/scripts/start.js
What I can do? Has anybody faced this issue?