React_on_rails: ReactOnRails::PrerenderError in HelloWorld#index

Created on 20 Sep 2017  路  2Comments  路  Source: shakacode/react_on_rails

Hi! I'm trying the react_on_rails gem, and when I changed the prerender option to true I'm getting this error, can you please help me?

I'm running rails on windows 7.

Thanks!

ERROR in SERVER PRERENDERING
Encountered error: "ReferenceError: self is not defined"
when prerendering HelloWorld with props: {"name":"Stranger"}
js_code was:
(function() {
  var railsContext = {"inMailer":false,"i18nLocale":"en","i18nDefaultLocale":"en","href":"http://localhost:3000/hello_world","location":"/hello_world","scheme":"http","host":"localhost","port":3000,"pathname":"/hello_world","search":null,"httpAcceptLanguage":"es-ES,es;q=0.8","serverSide":true};

  var props = {"name":"Stranger"};
  return ReactOnRails.serverRenderReactComponent({
    name: 'HelloWorld',
    domNodeId: 'HelloWorld-react-component-35aaa3ec-763b-407f-8ff1-f367864c3d84',
    props: props,
    trace: true,
    railsContext: railsContext
  });
})()
discussion

Most helpful comment

Hi @mmaauu that issue is documented in the README.

You can fix this right now if you add the "--inline=false" option to starting bin/webpack-dev-server.

We need to update the docs on this, and maybe the default generator. Let me know if you're interested in submitting a PR.

All 2 comments

Hi @mmaauu that issue is documented in the README.

You can fix this right now if you add the "--inline=false" option to starting bin/webpack-dev-server.

We need to update the docs on this, and maybe the default generator. Let me know if you're interested in submitting a PR.

Thanks @justin808 for taking time to answer!

Was this page helpful?
0 / 5 - 0 ratings