-
Notifications
You must be signed in to change notification settings - Fork 13
Some Questions + running in a release/production #44
Comments
I have a modified fork of this repo made to work with svelte.js, we're using it with My understanding of the console logging issue is due to the way elixir-nodejs works—a given component is rendered in My way around this was to create a |
Thanks @benwoodward! Yea I figured as much about the logging problem, your CLI idea is a good work around, will try it! Wonder if in the renderer process we can somehow redirect console.log statements elsewhere, retaining the functionality of the render call, if this was an optional flag would still be able to debug in the way you are via the CLI utility... Think even just resigning the function to a no-op would work
UPDATE: Can confirm, updating the require("@babel/polyfill");
require("@babel/register")({ cwd: __dirname });
console.log = (...args) => {};
module.exports = require("react_render/priv/server");
``
|
@benwoodward I am having some trouble getting the cli script working for react. I am still a bit unclear on how the dependencies are being loaded when run in the context of elixir, and when running directly against node, like the example in the cli comments, I am getting the following error:
And obviously the server render pretty much blows up at that point. But still works running it via elixir...I am hoping this is more related to module loading than react, as I know your fork is running svelte. Any ideas? I can see you are using require('@babel/polyfill')
require('@babel/register')({cwd: __dirname}) This is where I think the problem lives, and as mentioned above this bit is what I don't fully understand... Regarding the root of all this, I have also tried with some success overwriting In const fs = require("fs");
// whatever outstream, for examples sake:
const out = fs.createWriteStream("./out");
const redirectedConsole = new console.Console(out);
# and reassigning the global console.x functions
console.log = redirectedConsole.log;
console.error = redirectedConsole.error;
# ... etc
module.exports = require("react_render/priv/server"); So now we don't error out when |
You're running your |
Was able to get it working, here is a gist Needed to run : require("@babel/polyfill");
require("@babel/register")({ cwd: __dirname }); And it seems to fix the problem I was having. I have resorted to just:
In my render_server as a decent mechanism of keeping the process crashing because of logs. Could probably be packaged up into its own module and used along side a more generalized SSR library to provide a nicer development experience - with all logs appearing in the same console, reminiscent of frameworks like NextJS. |
Sorry, did not see this ticket. There is a known issue in |
This lib looks great! Any updates on this issue? Is this still maintained? |
This is pretty awesome, and looking to put it or maybe slight variant into production.
mix release
and in production?console.log
statements in JS components causing theReactRender.render
function to fail. Is this a bug? should we try and shim out console.log when running on the server?console.log
in anisBrowser
function to ensure it only runs client side, but this is not ideal. (maybe this should be its own issue?)Thanks for publishing!
The text was updated successfully, but these errors were encountered: