流量路由器 ssr , meteor 和 material ui

Flow router ssr , meteor and material ui

我正在使用 meteor 1.4 和 material ui 进行反应,我收到此错误

warning.js:36 Warning: 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) ;width:100%;display:flex;padding-left:24 (server) ;width:100%;display:-webkit-box,-moz-box

我该如何解决这个问题?

您需要找到使服务器呈现与客户端不同的东西的原因。我想在 material-ui 中有一些浏览器可以打开某些功能。一旦你找到了,我可以提供更多帮助。

参见:this issue was discussed here

您需要在客户端和服务器上使用相同的process.env.NODE_ENV

解决方案:使用 webpack(或 browserify):

new webpack.DefinePlugin({
process: {
    env: {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV)
    }
}})

更多信息:http://www.material-ui.com/#/get-started/server-rendering