Images with @2x or @3x in their file names are not resolved (breaks static image resources)
See original GitHub issueDo you want to request a feature or report a bug?
Report a bug
What is the current behavior?
Images with @2x
or @3x
in the file name are not resolved when doing require('../myImage@2x.png')
. If I remove the @
then it loads the file without an issue.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
Others have reproduced this behavior as you can see 👉 https://github.com/facebook/react-native/issues/15030
What is the expected behavior?
I expect the files to load and be resolved without an issue. This problem breaks static image resources 👉 https://facebook.github.io/react-native/docs/images.html#static-image-resources
Please provide your exact metro-bundler configuration and mention your metro-bundler, node, yarn/npm version and operating system.
I’ve used the stock version that comes with react-native 0.47.1
.
I’ve also tried --reset-cache
and finally I’ve also updated metro-bundler to version 0.11.0
.
npm
5.0.3
yarn
0.27.5
Mac OSX
10.12.6
The only workaround I’ve found is to remove the @
when requiring the file
Issue Analytics
- State:
- Created 6 years ago
- Reactions:9
- Comments:5 (1 by maintainers)
Top GitHub Comments
Yes, a specific error message sounds good to me. I would not refer to this issue though, I’d just mention that removing the scale specifier solves the problem.
@jeanlauliac Is it an idea to add a better error if someone does use
@2x
and then refer to this issue?