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.
![invalid options object dev server, webpack 4 to 5, Invalid options object, web pack, Dev Server](https://frontendguruji.com/blog/wp-content/uploads/2023/02/Screenshot-2023-02-02-at-3.16.16-PM-1024x192.png)
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 🙏