Skip the lifecycle-related code outside of the browser env #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My line of thinking here is that UI libraries tend to over ship code in node because it's not that easy to serve different codes in browsers and in node. However, a lot of the code that we ship is browser-only - for the server it's just redundant cruft. On the server we can't execute any effects, state is a one-off, etc etc. What if we just throw away client-specific code in node? With the current tooling setup this is actually fairly easy.
I don't expect those code changes to be 100% correct. I just put this together quickly without analyzing this deeply. I just wanted to learn how much we could roughly save by doing smth like this. The result ain't bad at all! With those changes, we go from 5601 bytes (min+gzipped) to 1691 bytes. That's a 70% reduction on the server side.