-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multi project support to babel plugin relay #4934
Open
tomfuhrer
wants to merge
8
commits into
facebook:main
Choose a base branch
from
tomfuhrer:add-multi-project-support-to-babel-plugin-relay
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add multi project support to babel plugin relay #4934
tomfuhrer
wants to merge
8
commits into
facebook:main
from
tomfuhrer:add-multi-project-support-to-babel-plugin-relay
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit adds support for multi-project Relay configurations to the Babel plugin. Now, the plugin can correctly determine which project configuration to use based on the file path, matching the behavior of the Relay compiler. Key changes: - Add functions to map file paths to project configurations - Implement project prioritization for files matching multiple projects - Add warnings for conflicting project settings - Map multi-project field names to single-project equivalents (output → artifactDirectory) - Update type definitions to include multi-project configuration fields The plugin still maintains backward compatibility with single-project configurations.
This commit adds a thorough test suite for the multi-project configuration feature in babel-plugin-relay. The tests verify: - File path to project mapping functionality - Project-specific setting application - Most specific path matching prioritization - Handling of multiple matching projects - Warning generation for conflicting settings - Cross-platform path handling - Various edge cases (null projects, empty arrays, etc.) - Combination of global and project-specific settings These tests ensure the plugin correctly handles multi-project Relay configurations, matching the existing behavior of the Relay compiler.
@tyao1 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.