我已经开始在“通用”应用程序(react-router、redux、webpack - 主要基于https://github.com/erikras/react-redux-universal-hot-example)中实现代码拆分。
在实现代码拆分的(唯一)路线上,我在进行完整的浏览器刷新时收到以下 React 错误消息:
warning.js:44Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
(client) <!-- react-empty: 1 -
(server) <div class="root" dat
如果我禁用代码拆分,错误消息就会消失。我猜这是因为 React 在 Webpack 加载器加载 Javascript 块之前进行了第一次渲染,因此它生成的标记与服务器上生成的标记不同。那是对的吗?
- 我应该担心错误消息吗?
- 有什么方法可以确定在此消息发生的确切时间 React 呈现什么?
- 有什么办法可以让消息消失吗?(除了不使用代码拆分)