Skip to content

serializer.unstable_getAsyncDependencyPath: Allow integrators to supply custom path types to __loadBundleAsync. - #1855

Closed
robhogan wants to merge 1 commit into
mainfrom
export-D112630265
Closed

serializer.unstable_getAsyncDependencyPath: Allow integrators to supply custom path types to __loadBundleAsync.#1855
robhogan wants to merge 1 commit into
mainfrom
export-D112630265

Conversation

@robhogan

Copy link
Copy Markdown
Contributor

Summary:
Async dependency paths are a property of Metro's _$$_DEPENDENCY_MAP passed to __loadBundleAsync, used to implement lazy edges - conceptually they are a pointer to the (usually remote) location of an async-loadable segment. As an implementation detail, lazy dev bundling uses strings - relative URLs - in paths, and these are passed to fetch.

See the original RFC: https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md

At Meta, Metro-Buck, with its custom serialiser, populates paths not with strings but with objects containing the data needed to construct URLs.

This extends the core serialiser with a hook that may be used to provide custom paths, so that Metro-Buck can implement its logic on top of the OSS serialiser rather than forking it.

The integrator is responsible for both sides of this serialiser <-> runtime contract:

  • unstable_getAsyncDependencyPath allows the integrator to return any JSON-serialisable value. Metro encodes these into the bundle.
  • __loadBundleAsync at runtime accepts the same type.

This change is non-breaking in itself - the argument to __loadBundleAsync does not change unless the user supplies unstable_getAsyncDependencyPath.

Changelog:

 - **[Experimental]**: Add `serializer.unstable_getAsyncDependencyPath` to supply custom `paths` to framework-defined `__loadBundleAsync`

Reviewed By: huntie

Differential Revision: D112630265

…ly custom path types to `__loadBundleAsync`.

Summary:
Async dependency `paths` are a property of Metro's `_$$_DEPENDENCY_MAP` passed to `__loadBundleAsync`, used to implement lazy edges - conceptually they are a pointer to the (usually remote) location of an async-loadable segment. As an implementation detail, lazy dev bundling uses strings - relative URLs - in `paths`, and these are passed to `fetch`.

See the original RFC: https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md

At Meta, Metro-Buck, with its custom serialiser, populates `paths` not with strings but with objects containing the data needed to construct URLs.

This extends the core serialiser with a hook that may be used to provide custom `paths`, so that Metro-Buck can implement its logic on top of the OSS serialiser rather than forking it.

The integrator is responsible for both sides of this serialiser <-> runtime contract:
 - `unstable_getAsyncDependencyPath` allows the integrator to return any JSON-serialisable value. Metro encodes these into the bundle.
 - `__loadBundleAsync` at runtime accepts the same type.

This change is non-breaking in itself - the argument to `__loadBundleAsync` does not change unless the user supplies `unstable_getAsyncDependencyPath`.

Changelog:
```
 - **[Experimental]**: Add `serializer.unstable_getAsyncDependencyPath` to supply custom `paths` to framework-defined `__loadBundleAsync`
```

Reviewed By: huntie

Differential Revision: D112630265
@meta-codesync

meta-codesync Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@robhogan has exported this pull request. If you are a Meta employee, you can view the originating Diff in D112630265.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 11, 2026
@meta-codesync meta-codesync Bot closed this in eb085e9 Aug 11, 2026
@meta-codesync meta-codesync Bot added the Merged label Aug 11, 2026
@meta-codesync

meta-codesync Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has been merged in eb085e9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant