Cannot find module ‘webpack/bin/config-yargs’

If you’re using webpack-cli 4 or webpack 5, change webpack-dev-server to webpack serve. Example: “serve”: “webpack serve –config config/webpack.dev.js –progress” You might want also check this comment on GitHub: NPM package.json scripts are a convenient and useful means to run locally installed binaries without having to be concerned about their full paths. Simply define a … Read more

I am getting an “Invalid Host header” message when connecting to webpack-dev-server remotely

The problem occurs because webpack-dev-server 2.4.4 adds a host check. You can disable it by adding this to your webpack config: devServer: { compress: true, disableHostCheck: true, // That solved it } Please note, this fix is insecure. Please see this answer for a secure solution. The option was refactored in version 4.0.0. The allowedHosts … Read more

Chrome CORS error on request to localhost dev server from remote site

Original Answer I finally found the answer, in this RFC about CORS-RFC1918 from a Chrome-team member. To sum it up, Chrome has implemented CORS-RFC1918, which prevents public network resources from requesting private-network resources – unless the public-network resource is secure (HTTPS) and the private-network resource provides appropriate (yet-undefined) CORS headers. There’s also a Chrome flag … Read more

CORS error even after setting Access-Control-Allow-Origin or other Access-Control-Allow-* headers on client side

Access-Control-Allow-Origin is a response header the server the request goes to must send. And all other Access-Control-Allow-* headers are response headers for servers to send. If you don’t control the server your request is sent to, and the problem with the response is just the lack of the Access-Control-Allow-Origin header or other Access-Control-Allow-* headers you … Read more