-
-
Notifications
You must be signed in to change notification settings - Fork 189
feat(rsc): ability to merge client reference chunks based on server chunk usage #767
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
Merged
hi-ogawa
merged 13 commits into
main
from
08-24-feat_rsc_merge_client_reference_chunks_based_on_server_chunk_usage
Aug 24, 2025
Merged
feat(rsc): ability to merge client reference chunks based on server chunk usage #767
hi-ogawa
merged 13 commits into
main
from
08-24-feat_rsc_merge_client_reference_chunks_based_on_server_chunk_usage
Aug 24, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 tasks
Base automatically changed from
08-23-feat_rsc_ability_to_merge_client_reference_chunks
to
main
August 24, 2025 05:22
d644fd8
to
1dda9a8
Compare
commit: |
hi-ogawa
commented
Aug 24, 2025
This was referenced Aug 24, 2025
…_based_on_server_chunk_usage
dai-shi
added a commit
to wakujs/waku
that referenced
this pull request
Aug 28, 2025
This PR enables client reference chunk optimization implemented by vitejs/vite-plugin-react#766 and vitejs/vite-plugin-react#767. I will likely enables this by default in next release, but testing on Waku for starter. The idea is similar to the one explained in https://devongovett.me/blog/parcel-rsc.html "Bundling client components" section. > One interesting thing you might notice is that "use client" is not an explicit code splitting point like dynamic import(). If you import more than one client component from a server component, the client components will be grouped together into a single bundle instead of split into separate bundles. This difference can be seen in `packages/website` where previously each `"use client"` component file becoming its own chunk e.g. https://waku.gg/ - `Destination` -> `/assets/destination-xxx.js` - `Start` -> `/assets/start-xxx.js` - `Fade` -> `/assets/fade-xxx.js` - `Menu` -> `/assets/menu-xxx.js` - `Navigation` -> ... - `Scroll` -> ... - etc. but now, some client component chunks are merged together based on server-side usage, e.g. https://waku-git-fork-hi-ogawa-08-24-featoptimi-f784e4-daishis-projects.vercel.app/ - `Destination`, `Start` -> `/assets/index-xxx.js` (only used in `/`) - `Fade`, `Menu`, `Navigation`, `Scroll` -> `/assets/fade-xxx.js` (shared by all pages `/`, `/blog`, ...) - etc. --------- Co-authored-by: Daishi Kato <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
It should be already possible on user land, but this PR adds pass more metadata to
clientChunks
option to do it easily.This means that controlling server chunk is a way to controlling client reference chunks. And it looks like this actually ends up with a same code splitting strategy as Parcel https://devongovett.me/blog/parcel-rsc.html.
TODO