尝试设置HMR,但遇到此错误:
[HMR]更新检查失败:错误:清单请求 http://localhost:8080/bdfcd3cc99a34de2ac8c.hot-update.json超时。 在XMLHttpRequest.request.onreadystatechange
获取http://localhost:8080/bdfcd3cc99a34de2ac8c.hot-update.json网:: ERR_CONNECTION_REFUSED
我的webpack配置如下:
output: {
// path: path.resolve(ROOT_PATH,'dist'),publicPath: 'http://localhost:8080/',filename: '[name].bundle.js',chunkFilename: '[id].bundle.js'
},mode: 'development',devtool: 'cheap-module-source-map',devserver: {
allowedHosts: ['.ec2.pin220.com'],// 0.0.0.0 binds to all interfaces. The public port is 8080 which is served
// by nginx and proxied to the internal webpack port of 10005.
host: '0.0.0.0',port: 10005,hot: true,hotOnly: true,compress: true,headers: {
'access-control-allow-origin': '*'
}
Webpack输出如下: