Skip to content

Commit

Permalink
RN local-cli: fix saveAsset scales filtering
Browse files Browse the repository at this point in the history
Reviewed By: fkgozali

Differential Revision: D5688676

fbshipit-source-id: 2cf6d08b626a6e8c55db0b2293e13300f9606332
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Aug 24, 2017
1 parent 6493a85 commit b6e0f4a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions local-cli/bundle/saveAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ function saveAssets(

const filesToCopy = Object.create(null); // Map src -> dest
assets
.forEach(asset =>
filterPlatformAssetScales(platform, asset.scales).forEach((scale, idx) => {
.forEach(asset => {
const validScales = new Set(filterPlatformAssetScales(platform, asset.scales));
asset.scales.forEach((scale, idx) => {
if (!validScales.has(scale)) {
return;
}
const src = asset.files[idx];
const dest = path.join(assetsDest, getAssetDestPath(asset, scale));
filesToCopy[src] = dest;
})
);
});

return copyAll(filesToCopy);
}
Expand Down

0 comments on commit b6e0f4a

Please sign in to comment.