Webpack 网页包HMR在分析错误时中断

Webpack 网页包HMR在分析错误时中断,webpack,webpack-dev-server,webpack-hmr,Webpack,Webpack Dev Server,Webpack Hmr,我的代码在没有使用HMR重新加载时出现问题。我正在使用CLI网页包开发服务器。将看到更改并重新编译网页包,但网站不会重新加载 控制台日志: [Log] [WDS] Hot Module Replacement enabled. [Log] [WDS] App updated. Recompiling... (x2) [Log] [WDS] App hot update... [Log] [HMR] Checking for updates on the server... [Warning] [

我的代码在没有使用HMR重新加载时出现问题。我正在使用CLI网页包开发服务器。将看到更改并重新编译网页包,但网站不会重新加载

控制台日志:

[Log] [WDS] Hot Module Replacement enabled.
[Log] [WDS] App updated. Recompiling... (x2)
[Log] [WDS] App hot update...
[Log] [HMR] Checking for updates on the server...
[Warning] [HMR] Update failed: parse@[native code]
onreadystatechange@http://localhost:8080/assets/vendor.js:67:38
此错误是插入的网页包代码的一部分:

request.onreadystatechange = function() {
     ...
  var update = JSON.parse(request.responseText); <-- this breaks
我使用以下命令调用webpack服务器:

webpack-dev-server --config tools/webpack.client.dev.js --hot --inline
可能是什么问题?看起来webpack接收到了要解析的无效信息,但我不知道这应该是什么或来自什么

客户端index.js文件与相同

我重新安排了交付初始渲染的代码,但它非常相似。这是原件。主要是我把它变成了一个全包路由
router.all('*')
,并对html做了一些修改,但大部分都是一样的。以下是脚本标记:

 <script>window.renderedClassNames = ${JSON.stringify(data.css.renderedClassNames)};</script>
 <script>window.INITIAL_STATE = ${JSON.stringify(initialState)};</script>
 <script src="${ env === 'production' ? '/assets/vendor.js' : 'http://localhost:8080/assets/vendor.js'}" ></script>
 <script async src="${ env === 'production' ? '/assets/main.js' : 'http://localhost:8080/assets/main.js'}" ></script>
然而,它从未被称为

有人能发光吗

 <script>window.renderedClassNames = ${JSON.stringify(data.css.renderedClassNames)};</script>
 <script>window.INITIAL_STATE = ${JSON.stringify(initialState)};</script>
 <script src="${ env === 'production' ? '/assets/vendor.js' : 'http://localhost:8080/assets/vendor.js'}" ></script>
 <script async src="${ env === 'production' ? '/assets/main.js' : 'http://localhost:8080/assets/main.js'}" ></script>
if (module.hot) {
  module.hot.accept('../common/routes/root', () => {
    unsubscribeHistory()
   setTimeout(render)
  })
 }