@@ -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 , getOriginalExtensionSrcSet } from '../utils' ;
9+ import { getBreakpointMedia , getPixelRatios } 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 pixelRatios : Dpr [ ] = getPixelRations ( options . originalPixelRatio ) ;
33+ const pixelRatios : Dpr [ ] = getPixelRatios ( options . originalPixelRatio ) ;
3434 const breakpoints : Breakpoint [ ] = options . breakpoints ;
3535 // Такой результат приходит от file-loader 'module.exports = "/build/myImage/mobile.all-4b767a7b.png";'
3636 // Получаем оригинальное имя файла изображения (originalImageFileName = mobile.all.png)
@@ -76,7 +76,10 @@ export const loader = function (this: webpack.loader.LoaderContext, source: stri
7676 srcSets : [
7777 {
7878 extension : originalExtension ,
79- srcSet : getOriginalExtensionSrcSet ( pixelRatios , outputImagePath ) ,
79+ srcSet : pixelRatios . reduce ( ( acc , item ) : SrcSet => {
80+ acc [ item ] = outputImagePath ;
81+ return acc ;
82+ } , { } as SrcSet ) ,
8083 } ,
8184 ] ,
8285 } ;
0 commit comments