title: Webpack-dev-server HMR not work when i add publicpath in output obj
body: <p>Just like title, when I add publicPath property in output, the HMR(Hot module replacement) not work, and when I remove it, It can work correctly. And below is my webpack configuration:</p>
  <pre><code>output: {
      path: path.resolve(__dirname, './dist'),
      filename: '[name].js',
      libraryTarget: 'umd',
      // globalObject: 'window',
      publicPath: `http://localhost:${PORT_NUMBER}` // this line, when I add, HMR not work
    },
    devServer: {
      hot: true,
      historyApiFallback: true,
      // 设置本地服务端口
      port: PORT_NUMBER,
      headers: {
        'Access-Control-Allow-Origin': '*',
      },
  </code></pre>
  <p>Who can help me solve it, Thanks a lot.</p>
  <p><strong>my webpack version is :  &quot;^5.72.0&quot;, and webpack-dev-server version is
  &quot;^4.8.1&quot;</strong></p>