I believe I have found the issue. The path needs to be relative.
This does not work: webpack --config webpack.config.js
This works: webpack --config ./webpack.config.js
The reason for the confusion is that it was not needed in webpack 4.
_Originally posted by @SoerenSilkjaer in https://github.com/webpack/webpack/issues/11643#issuecomment-706902767_
From the original issue it sounds like the problem only occurs with persistent caching as config filename is passed to buildDependencies. Pass the absolute filename otherwise webpack will try to resolve it relative to context which might not be identical to cwd.
Most helpful comment
From the original issue it sounds like the problem only occurs with persistent caching as config filename is passed to buildDependencies. Pass the absolute filename otherwise webpack will try to resolve it relative to
contextwhich might not be identical to cwd.