Webpack dev server connection to "ws://localhost:__/ws' failed continuously printing in the console

958 views Asked by At

After upgrading to webpack 5 this socket connection error is thrown in the console. I have tried this setting but didn't work. Here is my dev server setting,

const Port =  3500;
const Host = 'localhost';
const devServer = new WebpackDevServer(
  {
    hot: false,
    host: Host,
    port: Port,
    historyApiFallback: true,
    devMiddleware: {
      publicPath: `http://${Host}:${Port}/`,,
      stats: {
        colors: true,
        hash: false,
        version: false,
        chunks: false,
        children: false
      }
    }
  },{
  entry: {

    vendor: [
      'babel-polyfill',
      'jquery',
    ],
    app: [
      // 'babel-polyfill',     
      './app/startup',
      `webpack-dev-server/client?http://${Host}:${Port}`,
      'webpack/hot/only-dev-server'
    ],
  },
  devtool: 'eval-source-map';
  output : {
  filename: '[name]-bundle.js',
  path: path.join(__dirname, 'public'),
  publicPath: `http://${Host}:${Port}/`,
},
optimization: {
    splitChunks: {
      cacheGroups: {
       default: false
      }
    }
  },

}
);

enter image description here enter image description here Even though everything is working as expected What could be the reason it is throwing this?

0

There are 0 answers