-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix regression in dynamic resolution for out-of-tree platforms #20662
Closed
Closed
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d314ef8
Initial changes to make platform resolution dynamic for out-of-tree p…
matthargett 94425cc
Merge branch 'master' of github.com:matthargett/react-native into dyn…
matthargett a5190b7
Revert fixes for lint/prettier failures.
matthargett a51bffe
Merge branch 'master' of github.com:facebook/react-native into dynami…
matthargett 771df00
Take Name.es6.js and Name.es7.js into account for regexp.
matthargett 403930c
Revert prettier auto-fix.
matthargett 1f7f362
Adjust comment and regexp. Note weird error when only two platforms a…
matthargett 8dc4fe7
From @rozele: React Native overrides the settings for, e.g., , which…
matthargett 9edfa98
Merge branch 'master' of github.com:facebook/react-native into dynami…
matthargett 5207cd1
Remove hard-coded platform paths.
matthargett 0e72049
hasteImpl will be overridden via metro configurations of out-of-tree …
matthargett 3159e0c
Merge branch 'master' of github.com:facebook/react-native into dynami…
matthargett d366ea4
Update tests to remove out-of-tree platform specifics
matthargett 9ce4e7a
Fix comment
matthargett 5733fe1
My synthetic tests didn't capture real-world pathing. This should fix…
matthargett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this could use a comment, not sure how it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran a test on the regex, and I can't get it to match
Foo.native.js
. This is the code that I had commented in Slack about. Unfortunately,hasteImpl
is dynamically required byjest-haste-map
, so it's not trivial to inject "plugin" platform extensions.However, we can move to a model where plugin platforms must create their own
metro.config.js
andhasteImpl.js
file with the platform extensions in the regex forgetHasteName
, but that would mean it would be more challenging to add plugin platforms to projects that already have their ownmetro.config.js
. We could probably usebabel
to modify existingmetro.config.js
files and addhasteImplModulePath
if it's not already there, and just throw a warning if it's already there pointing to instructions on how to add the necessary platform behavior to theirhasteImpl.js
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this regex aims to strip out
.es6
suffixes, but it needs one more capture group. As it stands right now, it would takeindex.es6
and return.es6
, which is unlike the other reducers that strip out.js
or.flow.js
.It looks like you want to use
^([^\.]+)(\.es\d)?$
here, which would returnindex
in the above example.This doesn't match the comment from the line above it, however.