起因
最近升级了 Webpack5,项目运行起来之后 HMR 在 console 有如下提示
经过
一番搜寻后在 官方 issue 中找到了问题处理方式:
原文链接
结果
我们需要修改 webpack 的 out put 配置,修改或者添加下面两个配置即可
output: {
xxxxxx,
hotUpdateChunkFilename: '[id].[fullhash].hot-update.js',
hotUpdateMainFilename: '[runtime].[fullhash].hot-update.json',
},