I know that in the webpack.config.js
the HMR plugin and chunkhash can not be used together. But I don't know why. Can anybody explain it for me?
The wrong code is:
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
devtool: "eval-source-map",
entry: __dirname + "/app/main.js",
output: {
path: __dirname + "/build",
filename: "bundle-[chunkhash].js"//改为“bundle.js”及为正确的代码
},
plugins: [
new HtmlWebpackPlugin({
template: __dirname + "/app/index.tmp1.html"
}),
new webpack.HotModuleReplacementPlugin(),
],
}