不看会后悔—关于react-router4文档里面介绍服务端渲染的一段话

#1

Code-splitting + server rendering
代码分割 + 服务端渲染

We’ve tried and failed a couple of times. What we learned:
我们尝试了很多次都失败了,我们总结了下面几点:

1、You need synchronous module resolution on the server so you can get those bundles in the initial render.
你需要在服务端同步模块解析使得你可以在初始化渲染的时候得到那些文件。

2、You need to load all the bundles in the client that were involved in the server render before rendering so that the client render is the same as the server render. (The trickiest part, I think its possible but this is where I gave up.)
为了保证服务端渲染和客户端渲染的同步,你需要在客户端渲染前加载和服务端渲染一致的所有文件。(这也是我认为最难搞的地方,所以我放弃了)

3、You need asynchronous resolution for the rest of the client app’s life.
在客户端运行过程中,你需要异步解析其他没有在初始化渲染的部分。

We determined that google was indexing our sites well enough for our needs without server rendering, so we dropped it in favor of code-splitting + service worker caching. Godspeed those who attempt the server-rendered, code-split apps.
我们确定谷歌大神对我们网站的索引做得足够好,并不需要服务端渲染来解决SEO的问题,所以我们放弃了这种模式,而是采用更有利的代码分割 + service worker 缓存的方式。愿上帝:pray:那些想要尝试服务端渲染+代码分割的小:mouse2:

你有什么看法呢?