Skip to content
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

RFC: Lazy bundling #605

Merged
merged 4 commits into from
Apr 3, 2023
Merged

Conversation

motiz88
Copy link
Collaborator

@motiz88 motiz88 commented Feb 27, 2023

This RFC introduces lazy bundling, a DevX feature that is currently in use at Meta and makes bundling faster when developing large apps with many screens. The RFC describes the changes required to Metro and React Native, and the ways in which these changes will support future developments around bundle splitting and Server Components.

The open source version of this feature is in development and should ready in time for React Native 0.73.

View the rendered RFC

## Unresolved questions

* User-facing naming: Are we happy with "lazy bundling" as the name for this feature?
* APIs: Are we happy with `lazy=true` and `__loadBundleAsync` as the names for the new integration points between React Native and Metro?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__loadBundleAsync seems analogous to __webpack_require__.l (require.l (that's an L)). The concept of adding it to the require runtime seems elegant.

Co-authored-by: Nicola Corti <corti.nico@gmail.com>
facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Mar 21, 2023
Summary:
Changelog: [Internal]

Enables Flow in `Server-test`, `baseBytecodeBundle-test`, `baseJSBundle-test` and `getRamBundleInfo-test`, to unblock additional changes to the serializer in support of [lazy bundling](react-native-community/discussions-and-proposals#605).

Reviewed By: jacdebug

Differential Revision: D44184128

fbshipit-source-id: 53981514e17c901f351b3d2bb40b7ffaf5e875a6
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Mar 21, 2023
Summary:
Changelog: [General][Removed] Remove internal DevSplitBundleLoader native module

`DevSplitBundleLoader` was part of an experimental bundling strategy that offloaded Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.

As part of implementing the simpler and more general [lazy bundling RFC](react-native-community/discussions-and-proposals#605), we are removing `DevSplitBundleLoader` and associated code from React Native's internals.

Reviewed By: robhogan

Differential Revision: D43597007

fbshipit-source-id: 1460e9045cd7a0f5ef43144b10afb932172e223c
@motiz88 motiz88 merged commit 03de56b into react-native-community:main Apr 3, 2023
facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Apr 4, 2023
Summary:
Changelog:
 * **[Experimental]**: Pass full path and query params to `asyncRequire` for lazy bundles.

Moves the responsibility for setting query params on lazy bundle requests from the runtime to the serializer. This is a breaking change to any `asyncRequire` implementations currently relying on the experimental second parameter.

See the [lazy bundling RFC](react-native-community/discussions-and-proposals#605) for more context. Note that replacing `asyncRequire` using `asyncRequireModulePath` will itself be deprecated with the introduction of the `__loadBundleAsync` runtime hook.

Reviewed By: robhogan

Differential Revision: D43597023

fbshipit-source-id: 8943cfee04abd5f7e23b5cbb2047d401c728fe14
jeongshin pushed a commit to jeongshin/react-native that referenced this pull request May 7, 2023
Summary:
Changelog: [General][Removed] Remove internal DevSplitBundleLoader native module

`DevSplitBundleLoader` was part of an experimental bundling strategy that offloaded Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.

As part of implementing the simpler and more general [lazy bundling RFC](react-native-community/discussions-and-proposals#605), we are removing `DevSplitBundleLoader` and associated code from React Native's internals.

Reviewed By: robhogan

Differential Revision: D43597007

fbshipit-source-id: 1460e9045cd7a0f5ef43144b10afb932172e223c
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Changelog: [General][Removed] Remove internal DevSplitBundleLoader native module

`DevSplitBundleLoader` was part of an experimental bundling strategy that offloaded Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.

As part of implementing the simpler and more general [lazy bundling RFC](react-native-community/discussions-and-proposals#605), we are removing `DevSplitBundleLoader` and associated code from React Native's internals.

Reviewed By: robhogan

Differential Revision: D43597007

fbshipit-source-id: 1460e9045cd7a0f5ef43144b10afb932172e223c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants