Add unstable async bundle runtime to the JS Packager#9227
Merged
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. |
alshdavid
approved these changes
Sep 6, 2023
marcins
approved these changes
Sep 6, 2023
marcins
left a comment
Contributor
There was a problem hiding this comment.
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.
Contributor
Author
|
@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. |
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
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.
↪️ 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