symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 199 forks source link

AVIF images #1054

Open benbankes opened 3 years ago

benbankes commented 3 years ago

Have you considered adding support for .avif images? It looks like the version of file-loader being used is adequate. I wonder if this would only require a change to the line https://github.com/symfony/webpack-encore/blob/3598b188592c55131fa42d415f03e86a1301df77/lib/config-generator.js#L331

hracik commented 3 years ago

Tried to add avif in that line you mentioned and it works.

hracik commented 3 years ago

In the meantime that rule can be overrided inwebpack.config.js by code:

var Encore = require('@symfony/webpack-encore');
Encore.configureImageRule({}, loaderRule => {
    loaderRule.test = /\.(png|jpg|jpeg|gif|ico|svg|webp|avif)$/
})

configureLoaderRule method can be used also.