-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiled out process.env.NODE_ENV for Rax and React benchmarks #10
Conversation
@aickin Could we avoid compile server-side code to assets? Under normal circumstances, the server-side code is not required compile. |
And in real project, I think most people won't use this directory specification to works. |
@imsobear I disagree here. The right way to deploy React SSR to production is to compile out process.env.NODE_ENV on both server-side and client-side code. And to be clear, you were compiling the app code for server-side already, right? |
About SSR, my ideal way is that don't change the code way both in server-end and front-end. But the truth is front-end must do some change, we can't avoid that. And now for this problem, we need compile the routes or controllers code to assets. I think it is strange and ugly as a Noder. Maybe there is a better way to solve this problem. :) |
We preferentially try to solve the renderToString benchmark problem. And ignore the qps comparition temporarily. |
OK, so you want me to stop compilation of the controllers and remove the qps benchmark? |
Yes, don't compile the controllers and ignore qps benchmark temporarily. And we just solve the problem that how to |
I'm pretty sure this won't work (and I know it isn't a supported way to use the library). Didn't you try it already and have problems? |
Yeah, It can't works. In my opinion, if this way could greatly improve React SSR performance. React should support this ability or a best practice. I don't agree with use many hacks for this feature. Thanks for your guidance. And I have learned a lot from your video. 😅 |
I tend to agree that "compiling server side code with webpack to remove access to Maybe we can add this optimization as a separate entry in the benchmarks? (preserve P.S. I've seen on Twitter that the React team is considering exporting a pre-compiled bundle for |
This is a new version of #5, built on top of #7. It compiles out
process.env.NODE_ENV
in both the Rax and React benchmarks, in both therenderToString
and server versions. It cannot compile outprocess.env.NODE_ENV
in Vue because Vue's server renderer is not webpack-compatible.For more background, read #5, #6, and #7.
On my machine, before this PR, I get:
And after: