Inlined assets with fractional scales resolve to the wrong variant
維護者通常 2 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- react-native, typescript, webpack
- 領域
- build-system
研究方向
Read the Re.Pack assets loader's inlineAssets path and its call to AssetSourceResolver.pickScale. The report identifies the unsorted scale list and gives reproductions at pixel ratios 3.5 and 1.5; confirm the expected variant against those cases. Done means fractional and integer scale variants resolve correctly. Pull request #1505 is already open for this issue.
由索引模型根據 Issue 內容生成。
描述
Description
With inline: true in the assets loader, an image that has a fractional scale variant (@0.75x or @1.5x) resolves to the wrong scale at runtime.
inlineAssets passes Object.keys(sourceSet).map(Number) to AssetSourceResolver.pickScale. Integer-like object keys are listed before other keys, so [0.75, 1, 1.5, 2, 3] becomes [1, 2, 3, 0.75, 1.5]. pickScale expects an ascending list ("Packager guarantees that scales array is sorted").
Reproduction
- Add
[email protected],[email protected],[email protected]and[email protected]. - Enable
inline: truefor the Re.Pack assets loader and renderrequire('./star.png'). - Run on an Android device with a pixel ratio of 3.5.
Expected: the @3x image. Actual: the @1.5x image. A pixel ratio of 1.5 gets @2x instead of @1.5x.
Environment
@callstack/repack main (5.4.2), any React Native version.
- 主要語言
- TypeScript
- 星號
- 1.9k
- 分支
- 177
- 平均合併
- 2 天 10 小時
- 30 天內合併 PR
- 23
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
callstack/repack 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 82/100
callstack/repack#1515 · 2 則留言 ·
維護者通常 2 天內回覆
-
remove absolute file paths embedded in sourcemaps generated by `SourceMapPlugin`可能已有人在做 @JaydeepAgravat 於 3 天前認領。 未關閉status:new type:feature
難度 3/5 1-2 天 新手友好度 50/100
callstack/repack#1518 · 1 則留言 ·
維護者通常 2 天內回覆
-
ScriptManager caches the rejected promise when a resolver throws, so loadScript/prefetchScript never retry可能已有人在做 @linhh-phv 於 18 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 35/100
維護者通常 2 天內回覆
-
json as string in JS bundle可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 35/100
callstack/repack#1461 · 1 則留言 ·
維護者通常 2 天內回覆
-
area:repack type:feature
難度 5/5 一週以上 新手友好度 42/100
callstack/repack#1423 · 1 則留言 ·
維護者通常 2 天內回覆
相似的 Issue
-
area:cards enhancement ready-for-agent
難度 2/5 1-3 小時 新手友好度 66/100
fil-donadoni/tolaria#8883 ·
維護者通常 1 天內回覆
-
bug 🐛
難度 2/5 1-3 小時 新手友好度 78/100
comunica/comunica#1960 · 1 則留言 ·
維護者通常 1 天內回覆
-
Waiting for: Product Owner
難度 2/5 1-3 小時 新手友好度 76/100
getsentry/sentry-javascript#26203 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
bytedance/flowgram.ai#1235 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
devswha/herdr-web-ui#3325 ·