Today while updating Webpack 4 to 5, got below error:
ValidationError: Invalid options object Dev Server has been initiated using an options object that does not match the API schema.
After some analysis 🔎, found that there are changes in the options we provide to Webpack Dev Server in Webpack 5.🕵️♂️
Invalid options object Dev Server – Updating Webpack 4 to 5
Below changes are needed in webpack devserver configurations:
contentBase:”public” is now static: {directory: “public”}
disableHostCheck: true is now allowedHosts: “all”
clientLogLevel: ‘info’ is now client: {logging: ‘info’}
For more changes, visit Webpack changelog.
More articles on Issues & solutions.
Thanks 🙏