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
Codesplitting across reexports using symbol data #8393
Closed
Closed
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
mischnic
force-pushed
the
symbols-codesplit
branch
from
August 12, 2022 14:16
82f469b
to
6566e0e
Compare
mischnic
force-pushed
the
symbols-codesplit
branch
from
August 22, 2022 13:12
ac8ef5f
to
ff6e4c6
Compare
mischnic
force-pushed
the
symbols-codesplit
branch
from
August 24, 2022 18:13
ff6e4c6
to
9ee9ecf
Compare
Superseded by #8432 |
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.
Closes #7392
Symbol propagation already does the traversals anyway, so now it just always tracks for each symbol in a dependency, what that symbol should resolve to.
Then, once it encounters a non-reexport dependency, it checks if all symbols in that dependency resolve to the same asset, and rewrites the edge from the dependency to the asset to point to the original asset that has the symbol (or at least as far down as possible, in case some deopt or non-static situation was encountered).
Since it's possible to rename symbols via reexports, I've had to add an additional map to the dependency node, e.g. a dependency to a side-effect-free asset that does
export {foo as bar} from "y";
would then be rewritten to point directly toy
instead, and thesymbolTarget
map then hasfoo -> bar
which is applied transparently inbundleGraph.getUsedSymbols
andbundleGraph.getSymbols
(which I think is a better solution compared to mutating the actual DependencyValue symbols entry).A pleasant surprise:
Doing
import("lodash-es").then(({add}) => add(1,2))
will be redirected to behave likeimport("lodash-es/add").then(...)