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
});
})()
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!
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.