为什么HotModuleReplacementPlugin使用Hard-Reload而不是Hot-Reload?

时间:2017-12-01 08:05:11

标签: reactjs webpack webpack-dev-server webpack-2 webpack-hmr

为什么更改代码后页面难以重新加载?或者为什么它没有使用热重载而不是硬重载? HotModuleReplacementPlugin有什么问题吗?

let serverConfig = {
  watchOptions:{
    aggregateTimeout: 300, //delay
    poll: 1000, // Poling interval
  },
  hot: true,
  inline: true,
  historyApiFallback: true,
  compress: true,
  disableHostCheck: true,
  staticOptions: {
  },
  stats: { colors: true },
  contentBase: '../build/',
  publicPath: webpackConfig.output.publicPath,
  headers: {
    'X-Custom-Header': 'yes'
  },
  proxy: {
    '/**': {
      target: '/index.html',
      secure: false,
      bypass: function (req, res, proxyOptions) {
        if (req.path=='/config') {
          return res.json(_config.runtime)
        }
        return '/'
      }
    }
  },
}

0 个答案:

没有答案