score:0

Your install command is:

npm i --D webpack@5.24.0 webpack-cli webpack-server html-webpack-plugin babel-loader webpack-dev-server

This means, it tries to add the following six packages:

  • webpack@5.24.0
  • webpack-cli
  • webpack-server
  • html-webpack-plugin
  • babel-loader
  • webpack-dev-server

But webpack-server is not a thing. Remove it.

If you look closely at your error message, it kinda tries to tell you the same thing:

npm ERR! Could not resolve dependency:

npm ERR! peer react@"~0.9" from webpack-server@0.1.2

It says that it fails to satisfy dependencies caused by this webpack-server. Make sure to get rid of it. That will at least fix this problem.

Your next problem

NOTE however, that for further customization of CRA's webpack build, given you don't want to eject, you also need a way to override it's default build settings.

For that, you might want to check out CRACO.

CRACO (like Webpack Module Federation) does not have very good documentation, but it has a few webpack-related examples here.


Related Query

More Query from same tag