Bug in resolving .(android | ios).js files accessed directly without index.js
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
I think there's a little bug in current metro-resolver.
Steps to reproduce :
Let say i have folder named folderA/ and inside it I have 2 files someFile.android.js and someFile.ios.js. And now I am using that file by importing like
import Something from 'folderA/someFile'.
But metro resolver always picks ios file in android.
If i add one index.js and access files through it like
import Something from 'folderA' then it works fine.
(Assuming index.js is added in folderA and its content is export default from ./someFile)
If this is indeed a bug and reproducible by others as well, I can raise a PR for the same.
Thanks :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the metro-resolver entry point and reproduce the import from folderA/someFile using the provided Android and iOS filenames. Compare direct-file resolution with resolution through folderA/index.js; done means the direct import selects someFile.android.js on Android and someFile.ios.js on iOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100