Skip to content

feat(tools-react-native): Add mergeTransformerConfigs function to @rnx-kit/tools-react-native#4044

Open
JasonVMo wants to merge 6 commits intomainfrom
user/jasonvmo/rn-metro-utils
Open

feat(tools-react-native): Add mergeTransformerConfigs function to @rnx-kit/tools-react-native#4044
JasonVMo wants to merge 6 commits intomainfrom
user/jasonvmo/rn-metro-utils

Conversation

@JasonVMo
Copy link
Copy Markdown
Collaborator

Description

This adds a utility for merging transformer configurations to tools-react-native to help with transformer merging. I added this as part of a new submodule called metro-utils for general metro utility functions.

I considered various other places for this. The main package it would make sense in is @rnx-kit/metro-config but that isn't a utility package used by other packages in react-native and has issues if you try to include it as a dependency of the cli. Given the already existing utilities for resolving packages from metro it made the most sense to add it to tools-react-native.

The function itself is straightforward and will perform a flat merge (which is what metro does) except if there are multiple getTransformOptions implementations in which case they will be wrapped with the results merged together in order of precedence. This function is used to initialize the babel transformers, it is called once with the results being serialized via json to the metro transformers.

Having the merge function be baked into the CLI is required so that any transform options being set by a transformer configuration don't get stomped by the esbuild transformer which is always added at the end. The esbuild transform options will take precedence still, but things like custom options can still be used in this case.

@github-actions github-actions bot added the feature: cli This is related to CLI label Mar 24, 2026
JasonVMo and others added 3 commits April 13, 2026 17:54
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
@JasonVMo JasonVMo enabled auto-merge (squash) April 14, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: cli This is related to CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants