Skip to content

Commit ed21815

Browse files
committed
feature #1074 Rebase of avif support (benbankes, weaverryan)
This PR was merged into the main branch. Discussion ---------- Rebase of avif support Just a rebase of #1056 - probably the failures there were temporary to when that PR was opened. Commits ------- 1f6874e updating tests abd66f4 Also modify the test images rule 2d0c725 Support AVIF images
2 parents dd8a6a6 + 1f6874e commit ed21815

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/config-generator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class ConfigGenerator {
328328

329329
if (this.webpackConfig.imageRuleOptions.enabled) {
330330
rules.push(generateAssetRuleConfig(
331-
/\.(png|jpg|jpeg|gif|ico|svg|webp)$/,
331+
/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/,
332332
this.webpackConfig.imageRuleOptions,
333333
this.webpackConfig.imageRuleCallback,
334334
'images'

test/config-generator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ describe('The config-generator function', () => {
881881

882882
const actualConfig = configGenerator(config);
883883

884-
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, actualConfig.module.rules).oneOf[1];
884+
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, actualConfig.module.rules).oneOf[1];
885885
expect(imagesRule.type).to.equal('asset/resource');
886886
expect(imagesRule.generator).to.eql({ filename: 'images/[name].[hash:8][ext]' });
887887
expect(imagesRule.parser).to.eql({});
@@ -904,7 +904,7 @@ describe('The config-generator function', () => {
904904

905905
const actualConfig = configGenerator(config);
906906

907-
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, actualConfig.module.rules).oneOf[1];
907+
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, actualConfig.module.rules).oneOf[1];
908908
expect(imagesRule.type).to.equal('asset/resource');
909909
expect(imagesRule.generator).to.eql({ filename: 'file.[hash][ext]' });
910910
});
@@ -921,7 +921,7 @@ describe('The config-generator function', () => {
921921

922922
const actualConfig = configGenerator(config);
923923

924-
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, actualConfig.module.rules).oneOf[1];
924+
const imagesRule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, actualConfig.module.rules).oneOf[1];
925925
expect(imagesRule.parser).to.eql({ dataUrlCondition: { maxSize: 3000 } });
926926
});
927927

@@ -937,7 +937,7 @@ describe('The config-generator function', () => {
937937
const actualConfig = configGenerator(config);
938938

939939
expect(function() {
940-
findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, actualConfig.module.rules);
940+
findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, actualConfig.module.rules);
941941
}).to.throw();
942942
});
943943
});
@@ -1229,7 +1229,7 @@ describe('The config-generator function', () => {
12291229
});
12301230

12311231
const webpackConfig = configGenerator(config);
1232-
const rule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, webpackConfig.module.rules).oneOf[1];
1232+
const rule = findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, webpackConfig.module.rules).oneOf[1];
12331233

12341234
expect(rule.generator.filename).to.equal('dirname-images/[hash:42][ext]');
12351235
});

0 commit comments

Comments
 (0)