Add multi project support to babel plugin relay #4934
+983
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add multi-project configuration support to babel-plugin-relay
Fixes #4909 - This PR addresses the bug where
eagerEsModules: true
doesn't work with multi-project Relay configurations.What is changing?
The Babel plugin now aligns with the Relay compiler's configuration system by supporting multi-project configurations:
eagerEsModules
) based on file locationWhy is this important?
Previously, there was a configuration mismatch between the Babel plugin and the Relay compiler. While the compiler supported different settings for different parts of a codebase through its multi-project configuration, the Babel plugin did not properly handle this format.
This implementation brings parity between the two tools, ensuring consistent behavior throughout the Relay toolchain. Users can now define their configuration once and have it work correctly for both the Relay compiler and the Babel plugin.
Most importantly, it fixes a bug where
eagerEsModules: true
would not work correctly in multi-project configurations.Implementation details
Backwards compatibility
This change is fully backward compatible with existing single-project configurations.
Testing
The implementation is covered by a comprehensive test suite that verifies:
eagerEsModules: true
All existing tests continue to pass, ensuring backward compatibility.