You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose build entry point for AssetRegistry (#57232)
Summary:
Pull Request resolved: #57232
**Problem**
Following D108750303, we now expose an `AssetsRegistry` API from `'react-native'`.
This is great, as we need to replace a deep `/Libraries/...` import in Metro configs (`transformer.assetRegistryPath`):
https://www.internalfb.com/code/fbsource/[31661d52e803d77356725429f44331135601b634]/xplat/js/react-native-github/packages/metro-config/src/index.flow.js?lines=87
**Unfortunately**, we can't quite reuse the new `AssetRegistry` API from the index module, as we'd break Metro's API contract (generate an inline require) — we need a dedicated wrapper module that can be read without destructuring.
**This diff**
Adds a new `'react-native/asset-registry'` secondary entry point, intended/documented for this Metro config use case — and deprecates `react-native/assets-registry/registry`.
- Solves the above problem (migrated in our own `react-native/metro-config` use).
- Remains consistent with D108750302 (we intend to remove `react-native/assets-registry` at a later date).
- As a bonus, fixes the longstanding naming inconsistency between `react-native/assets-registry` and `'react-native/Libraries/Image/AssetRegistry'` — `AssetRegistry` (singular) is now canonical.
Changelog:
- [General][Breaking] - `react-native/Libraries/Image/AssetRegistry` is removed. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs).
- [General][Deprecated] - **assets-registry**: `react-native/assets-registry/registry` is deprecated. Please use the `AssetRegistry` API (apps/library code) and/or the `react-native/asset-registry` entrypoint (Metro/build configs).
Reviewed By: javache
Differential Revision: D108750303
Copy file name to clipboardExpand all lines: packages/assets-registry/README.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,10 +11,14 @@ Most apps never import this directly — assets are handled through `<Image>`.
11
11
12
12
## API
13
13
14
-
### `@react-native/assets-registry/registry`
15
-
16
-
> [!Note]
17
-
> Aliases to [`AssetRegistry`](https://reactnative.dev/docs/assetregistry) (since 0.87). Prefer importing directly from the `'react-native'` package in libraries.
0 commit comments