@@ -6,7 +6,7 @@ import { getImgproxyUrlBuilder } from './imgproxyUrlBuilder';
66import { Breakpoint , OrderedBreakpointSource , SrcSet , Dpr } from '../types' ;
77import { imageUrls } from './plugin' ;
88import { schema } from './loaderOptionsSchema' ;
9- import { getBreakpointMedia , getPixelRations } from '../utils' ;
9+ import { getBreakpointMedia , getPixelRations , getOriginalExtensionSrcSet } from '../utils' ;
1010
1111// Такое имя используется, если нужна одна картинка для всех разрешений
1212// В таком случаем не будут сгенерированы медиа выражения для разных breakpoint'ов
@@ -30,7 +30,7 @@ export const loader = function (this: webpack.loader.LoaderContext, source: stri
3030
3131 validateOptions ( schema , options , { name : 'Imgproxy responsive loader' , baseDataPath : 'options' } ) ;
3232
33- const pixelRations : Dpr [ ] = getPixelRations ( options . originalPixelRatio ) ;
33+ const pixelRatios : Dpr [ ] = getPixelRations ( options . originalPixelRatio ) ;
3434 const breakpoints : Breakpoint [ ] = options . breakpoints ;
3535 // Такой результат приходит от file-loader 'module.exports = "/build/myImage/mobile.all-4b767a7b.png";'
3636 // Получаем оригинальное имя файла изображения (originalImageFileName = mobile.all.png)
@@ -70,28 +70,21 @@ export const loader = function (this: webpack.loader.LoaderContext, source: stri
7070 let webpSrcSet : SrcSet , originalExtensionSrcSet : SrcSet , data : OrderedBreakpointSource ;
7171 // Отключает процессинг картинок, генерируется srcSet только для оригинального типа изображения
7272 if ( options . imgproxy . disable ) {
73- // TODO пока не смотрим disable
74-
75- originalExtensionSrcSet = {
76- '1x' : outputImagePath ,
77- '2x' : outputImagePath ,
78- '3x' : outputImagePath ,
79- } ;
8073 data = {
8174 order,
8275 breakpointMedia,
8376 srcSets : [
8477 {
8578 extension : originalExtension ,
86- srcSet : originalExtensionSrcSet ,
79+ srcSet : getOriginalExtensionSrcSet ( pixelRatios , outputImagePath ) ,
8780 } ,
8881 ] ,
8982 } ;
9083 } else {
9184 const buildUrlsForPixelRatios = getImgproxyUrlBuilder ( options . imgproxy ) ;
92- webpSrcSet = buildUrlsForPixelRatios ( pixelRations , outputImagePath , 'webp' ) ;
85+ webpSrcSet = buildUrlsForPixelRatios ( pixelRatios , outputImagePath , 'webp' ) ;
9386 originalExtensionSrcSet = buildUrlsForPixelRatios (
94- pixelRations ,
87+ pixelRatios ,
9588 outputImagePath ,
9689 originalExtension ,
9790 ) ;
0 commit comments