Skip to content

Commit d3fe204

Browse files
authored
Add note on request caching to lazy bundling RFC (#628)
Clarifies the caching semantics of `__loadBundleAsync` in the lazy bundling RFC.
1 parent ab17b2a commit d3fe204

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

proposals/0605-lazy-bundling.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Lazy Bundling
33
author:
44
- Moti Zilberman
5-
date: today
5+
date: 2023-04-03
66
---
77

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

67+
`__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.
68+
6769
If there is no `__loadBundleAsync` implementation available, the bundled code may throw a runtime error upon attempting to evaluate an `import()` call.
6870

6971
> **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.

0 commit comments

Comments
 (0)