Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class ConfigGenerator {

if (this.webpackConfig.imageRuleOptions.enabled) {
rules.push(generateAssetRuleConfig(
/\.(png|jpg|jpeg|gif|ico|svg|webp)$/,
/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/,
this.webpackConfig.imageRuleOptions,
this.webpackConfig.imageRuleCallback,
'images'
Expand Down
10 changes: 5 additions & 5 deletions test/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ describe('The config-generator function', () => {

const actualConfig = configGenerator(config);

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

const actualConfig = configGenerator(config);

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

const actualConfig = configGenerator(config);

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

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

expect(function() {
findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp)$/, actualConfig.module.rules);
findRule(/\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/, actualConfig.module.rules);
}).to.throw();
});
});
Expand Down Expand Up @@ -1229,7 +1229,7 @@ describe('The config-generator function', () => {
});

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

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