-
-
Notifications
You must be signed in to change notification settings - Fork 566
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
feat: splitChunks support usedExports #7485
Merged
Merged
Conversation
This file contains 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
github-actions
bot
added
release: feature
release: feature related release(mr only)
team
The issue/pr is created by the member of Rspack.
labels
Aug 7, 2024
✅ Deploy Preview for rspack canceled.
|
JSerFeng
force-pushed
the
feat/split-chunks-support-used-exports
branch
4 times, most recently
from
August 8, 2024 03:16
79c2fee
to
98fa976
Compare
!bench |
📝 Benchmark detail: Open
|
JSerFeng
requested review from
ahabhgk and
SyMind
and removed request for
ahabhgk
August 8, 2024 07:37
JSerFeng
force-pushed
the
feat/split-chunks-support-used-exports
branch
from
August 8, 2024 09:22
fb9b1d9
to
3526445
Compare
JSerFeng
force-pushed
the
feat/split-chunks-support-used-exports
branch
from
August 8, 2024 09:51
3526445
to
1c50910
Compare
ahabhgk
approved these changes
Aug 8, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
release: feature
release: feature related release(mr only)
team
The issue/pr is created by the member of Rspack.
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.
Summary
Docs: WIP
We have runtime optimization for used exports, for example when we have two entries named
foo
andbar
, and a shared moduleshared
which exports 2 valuesfoo
andbar
.foo
importsfoo
fromshared
bar
importsbar
fromshared
with default behavior, there will be 2
shared
modules in the final output, one contains onlyfoo
export forfoo
entry, and one contains onlybar
export forbar
entry.This is great. But when it comes to splitChunks, there will be problem.
if we have a cacheGroup that can select
shared
, then theshared
module maybe extracted into a separate chunk, thus the runtime optimization is gone.Now if you enable
splitChunks.usedExports
, whenshared
module is selected by a cacheGroup, the cacheGroup will calculate all possible combinations of how exports are used in different runtime.shared
withfoo
exported belongs tofoo
chunk, and withbar
exported belongs tobar
chunk, and if you didn't setcacheGroups.{cacheGroup}.name
, thenshared
modules will still exist for both runtime.Checklist