Skip to content

Commit

Permalink
Add note on request caching to lazy bundling RFC (#628)
Browse files Browse the repository at this point in the history
Clarifies the caching semantics of `__loadBundleAsync` in the lazy bundling RFC.
  • Loading branch information
motiz88 committed Apr 4, 2023
1 parent ab17b2a commit d3fe204
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion proposals/0605-lazy-bundling.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Lazy Bundling
author:
- Moti Zilberman
date: today
date: 2023-04-03
---

# RFC0605: Lazy Bundling
Expand Down Expand Up @@ -64,6 +64,8 @@ The first time an `import()` call is evaluated with a given target, the default
declare function __loadBundleAsync(path: SerializedBundlePath): Promise<void>;
```

`__loadBundleAsync` may be called multiple times with the same bundle path, including in parallel. It should implement caching as needed to avoid sending out unnecessary or duplicate requests. It is unspecified how `__loadBundleAsync` should derive its internal cache key from the provided bundle path.

If there is no `__loadBundleAsync` implementation available, the bundled code may throw a runtime error upon attempting to evaluate an `import()` call.

> **NOTE:** With the introduction of `__loadBundleAsync`, **we will deprecate the [`asyncRequireModulePath`](https://facebook.github.io/metro/docs/configuration/#asyncrequiremodulepath) option in Metro**. Providing a custom `__loadBundleAsync` implementation is expected to fulfil all current use cases for replacing `asyncRequire` at build time.
Expand Down

0 comments on commit d3fe204

Please sign in to comment.