Skip to content

Agree with custom transformers on the URL paths of assets - #2094

Open
robhogan wants to merge 1 commit into
mainfrom
pr2094
Open

robhogan wants to merge 1 commit into
mainfrom
pr2094

Conversation

@robhogan

@robhogan robhogan commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Since #1892, Metro's transformer gets an asset's URL path as a sixth argument, and getAssets computes it separately. Wrappers that forward only the five they declare (eg NativeWind's react-native-css-interop) get the old path, so release builds put monorepo assets where the app doesn't look:

bundle:     /assets/../shared/img
getAssets:  /assets/[metro-watchFolders]/1/shared/img
  • Metro's transformer reports the URL path it used, as unstable_assetUrlPath on asset outputs (a temporary migration helper).
  • getAssets uses it, or the project-relative path (as in 0.87.1) when a transformer doesn't report one.

Also needed in the 0.84.7 picks (#2070).

Changelog: Internal

Test plan:

  • New integration test with Metro's transformer and a wrapper. The wrapper case fails without this change.

@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 Oct 23, 2026
@robhogan robhogan changed the title Pass an asset's URL path to the transformer in its options Agree with custom transformers on the URL paths of assets Oct 23, 2026
Since #1892, Metro's transformer gets an asset's URL path as a sixth argument, and `getAssets` computes it separately. Wrappers that forward only the five they declare (eg NativeWind's `react-native-css-interop`) get the old path, so release builds put monorepo assets where the app doesn't look:

```
bundle:     /assets/../shared/img
getAssets:  /assets/[metro-watchFolders]/1/shared/img
```

- Metro's transformer reports the URL path it used, as `unstable_assetUrlPath` on asset outputs (a temporary migration helper).
- `getAssets` uses it, or the project-relative path (as in 0.87.1) when a transformer doesn't report one.

Also needed in the 0.84.7 picks (#2070).

Changelog: Internal

Test plan:
- New integration test with Metro's transformer and a wrapper. The wrapper case fails without this change.
@robhogan
robhogan marked this pull request as ready for review October 23, 2026 20:10
@robhogan robhogan mentioned this pull request Oct 23, 2026

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant