Compiled out process.env.NODE_ENV for Rax and React benchmarks#10
Compiled out process.env.NODE_ENV for Rax and React benchmarks#10aickin wants to merge 1 commit intoraxjs:masterfrom
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_ENVin both the Rax and React benchmarks, in both therenderToStringand server versions. It cannot compile outprocess.env.NODE_ENVin 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: