Comments (5)
@jeanlauliac Is it an idea to add a better error if someone does use @2x
and then refer to this issue?
from metro.
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.
from metro.
@jeanlauliac knows about assets.
from metro.
Sorry I've been lagging behind quite a lot.
About this issue: in Metro, assets are not meant to be required with a specific scale, since different devices might use different scales. In that example, requiring ./myImage.png
would cause either [email protected]
or [email protected]
to be used depending on the device screen pixel ratio (virtual-pixel to physical-pixel ratio, so to speak).
@mo-solnet can you explain what is the benefit of using require('../[email protected]')
over require('../myImage.png')
?
from metro.
I haven't got the time to try to fit a hint message somewhere in the stack, but I'll close this issue for now, as this is the expected behaviour, and scale specifiers should not be included in the name when requiring assets. Do feel free to send a PR to tweak error messages however.
The documentation mentions having different densities and does have the example without the density specifier, so I don't think it needs updating? (https://facebook.github.io/react-native/docs/images.html#static-image-resources)
from metro.
Related Issues (20)
- Cannot find module @callstack/out-of-tree-platforms after run `yarn start --reset-cache` in rn-tester app HOT 1
- How to use it in android tv?
- [Question]: Why is Metro hot update not affected by project size, as always fast HOT 1
- Issues with redux-saga when using unstable_enablePackageExports
- [website] "Fast", "Scalable", and "Integrated" images don't load.
- error: bundling failed: SyntaxError: Unexpected reserved type (any, string, func, Boolean ) HOT 1
- [Question]: Custom logo and welcome message on Metro server launch? HOT 4
- Metro on Windows: Cannot start server in new window because no terminal app was specified HOT 1
- Could not determine the dependecies of task ' :react-native-safe-area-context:generateDebugRFile' HOT 1
- Absolute Paths [global packages] are not working in React Native 0.73.1 HOT 2
- [`metro-transform-plugins`] Function calls prefixed with void together with optional chain (?.) are skipped on production (`dev: false`). HOT 1
- Cannot Conect Metro HOT 2
- web document link not correct HOT 2
- The Metro bundler does not connect to iOS devices HOT 1
- zip
- Is metro will support pnpm in the future? HOT 2
- Could not determine the dependencies of task ' :react-native-gesture-handler:generateDebugRFile' HOT 2
- [0.73.x] Metro crashes because of `__loadBundleAsync` HOT 6
- Unable to resolve module stream HOT 4
- [0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metro.