Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 作为谷歌搜索引擎优化抓取时的白色页面_Reactjs_Prerender - Fatal编程技术网

Reactjs 作为谷歌搜索引擎优化抓取时的白色页面

Reactjs 作为谷歌搜索引擎优化抓取时的白色页面,reactjs,prerender,Reactjs,Prerender,我一直在我的React应用程序上尝试很多东西来支持SEO,不幸的是,我只看到一个白色页面,没有任何结果。。以下是我尝试过的: (注:我实际上是在本地构建我的应用程序,并使用phantomjs检查结果。) 1-在我的应用程序顶部使用不同的多边形填充,例如 import 'es5-shim'; import 'es6-shim'; import 'babel-polyfill'; import 'url-search-params-polyfill'; import 'whatwg-fetch'

我一直在我的React应用程序上尝试很多东西来支持SEO,不幸的是,我只看到一个白色页面,没有任何结果。。以下是我尝试过的:

(注:我实际上是在本地构建我的应用程序,并使用phantomjs检查结果。)

1-在我的应用程序顶部使用不同的多边形填充,例如

import 'es5-shim';
import 'es6-shim'; 

import 'babel-polyfill';
import 'url-search-params-polyfill';
import 'whatwg-fetch';
2-禁用我的应用程序中的所有XHR呼叫

3-尽量简化应用程序,如

ReactDOM.render(<div>Hello, World!</div>, document.getElementById('app'));
ReactDOM.render(你好,World!,document.getElementById('app');
这里一切正常,在我的幻影结果中,我看到了“你好,世界!”

现在,每次我将根组件导入到ReactDOM.render中,我都会再次看到白色页面

我没有主意了,我想把我的应用程序改造成一个SSR应用程序,但我真的很想知道如果没有它这是可行的。听起来我的根组件可能太重,无法按时渲染


有什么我可以花点时间的想法吗

我建议您使用Chrome而不是phantomjs来测试页面。在Prerender.io上,我们看到很多情况下,phantomjs无法呈现较新的网站,只显示一个空白页面,因此我们使用Headless Chrome呈现网站,效果非常好