Skip to content

Conversation

@jbroma
Copy link
Contributor

@jbroma jbroma commented Jun 4, 2025

Summary:

Part of facebook/metro#1480

This PR introduces a way to override getModulesRunBeforeMainModule in @react-native/community-cli-plugin. Currently, the plugin completely ignores the existing metro config and hardcodes paths to InitializeCore from RN & potential OOT platforms.

Due to the nature of this change, it's not possible to bail out of overriding when the config is already present, because most setups already include defaults from @react-native/metro-config or metro-config.

To make this change non-breaking for existing setups, we can iterate over the paths from existing config and only add the current overrides if they are not already present in the config.

While the change does not allow full control over getModulesRunBeforeMainModule (meaning InitializeCore will always need to be included), it allows to control the order of startup modules, and allows for prepending something to the list, so that it can execute before the InitializeCore

Changelog:

[GENERAL] [ADDED] - Allow overriding getModulesRunBeforeMainModule in community-cli-plugin

Test Plan:

TBD

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jun 4, 2025
@jbroma jbroma changed the title fix: allow partial overriding of getModulesRunBeforeMainModule feat: allow partial overriding of getModulesRunBeforeMainModule Jun 5, 2025
@jbroma
Copy link
Contributor Author

jbroma commented Jun 5, 2025

Closing in favour of #51836

@jbroma jbroma closed this Jun 5, 2025
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. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants