ReactRender: Server Side Rendering for React Components

Can’t seem to edit my post, but I did find a solution. The above bug occurs because it the phoenix.js library attempts to call location which I am assuming is not defined in the node runtime and is browser specific.

You can replicate this @harmon25 by adding a test channel in your app, and then importing the socket.js file in your index page.

The solution, is quite simple, but basically you need to change:

const socket = new Socket("/socket", {});
let socket = new Socket("ws://localhost:4000/socket", {});

Which then bypasses the location calls and the app will compile correctly.

My only concern is that this will be an ongoing theme where the react app expects there to be a browser runtime present (e.g. through libraries etc.) and cause these issues.