Skip to content

Commit 03135e1

Browse files
committed
add type guard for number | undefined in imgproxyUrlBuilder
1 parent 820d213 commit 03135e1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/webpack/imgproxyUrlBuilder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ export const getImgproxyUrlBuilder = ({
3333
const compressionsRatio = getCompressionRatio(pixelRatios);
3434

3535
return pixelRatios.reduce((acc, item) => {
36-
acc[item] = buildImgproxyUrl(imagePath, compressionsRatio[item] || 0, extension);
36+
const dprResize = compressionsRatio[item];
37+
if (dprResize) {
38+
acc[item] = buildImgproxyUrl(imagePath, dprResize, extension);
39+
}
3740
return acc;
3841
}, {} as SrcSet);
3942
};

0 commit comments

Comments
 (0)