-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support parallel bundle imports in libraries #9156
Conversation
for (let b of this.bundleGraph.getReferencedBundles(this.bundle)) { | ||
let entry = b.getMainEntry(); | ||
let symbols = new Map(); | ||
if (entry && !this.isAsyncBundle && entry.type === 'js') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now async bundles in libraries are still referenced with parcelRequire
. Changing that would require additional changes to the runtimes, but we could fix it eventually.
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached BundlesNo bundle changes detected. React HackerNews ✅
Timings
Cold Bundles
Cached Bundles
AtlasKit Editor ✅
Timings
Cold Bundles
Cached Bundles
Three.js ✅
Timings
Cold BundlesNo bundle changes detected. Cached BundlesNo bundle changes detected. |
@@ -505,6 +505,7 @@ function createIdealGraph( | |||
*/ | |||
let bundleGroupRootAsset = nullthrows(bundleGroup.mainEntryAsset); | |||
if ( | |||
parentAsset.type !== childAsset.type && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
The scope hoisting packager makes some assumptions about how to access code in other bundles that don't hold in library builds. One of these is that it tries to use
parcelRequire
to access dependencies in other bundles rather than usingimport
orrequire
. This PR keeps track of assets in referenced bundles and generates code to access them via the appropriate module system instead.Right now this is only possible with a custom plugin that makes dependencies parallel. There was also a small bug in the bundler preventing that from working correctly (it used to merge them all into a single bundle like type changes). Eventually we might have a separate bundler for libraries that outputs a single asset per bundle, and the packager changes in this PR should also help with that.