Inlined assets with fractional scales resolve to the wrong variant

未關閉
#1,504 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

@RaphaelFakhri 已經在處理了。

開始於 2026年10月20日。

  • #1505 來自 @RaphaelFakhri —— 未關閉

評估

難度
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
  1. Add [email protected], [email protected], [email protected] and [email protected].
  2. Enable inline: true for the Re.Pack assets loader and render require('./star.png').
  3. 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 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

callstack/repack 的其他 Issue

查看 callstack/repack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。