-
-
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
Add unstable async bundle runtime to the JS Packager #9227
Conversation
Benchmark ResultsKitchen Sink ✅
Timings
Cold Bundles
Cached Bundles
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. |
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.
LGTM if this is still working as expected at runtime with the changes made! Just a few comments to add some comments to the short variable names.
It's not needed for our use case - but should the HTML packager add async
to script tags if this feature is enabled? I guess that then ties into config that needs to span multiple packages/plugins.
@marcins I agree we might need to do some HTML work to get this fully released. I was thinking maybe adding async to the HTML entrypoint might trigger the behaviour. However I'll leave that for a future revision. |
↪️ Pull Request
This PR adds an experimental bundle queueing runtime to the JS packager, allowing bundles to be loaded out of order. Our primary use-case is when loading scripts with
type="module" async
. This allows scripts to start executing ASAP but without any order guarantees.The runtime only caters to scope hoisted ESM bundles for now and can be enabled by setting the following config in the root package.json.
🚨 Test instructions
I've added a test which enables the feature, ensures the runtime is present and executes the bundles.
✔️ PR Todo