Closed kylemh closed 4 years ago
@kylemh Sorry for the late response. I like the solution 👏 but I'm also thinking that maybe it's better to touch the config file as few as possible. So maybe it's better to do it in the opposite way and just mention the extensions we want to ignore?
To be clear, @arefaslani you're asking me to do the alternative I recommended?
@kylemh Yes and thanks for the help :)
I personally like the solution I have here, since it's not a breaking change in terms of semantic versioning. exclude
already accepts an array as a valid solution, so we'd be going against the normal behavior of webpack loaders.
Additionally, people will be able to upgrade this dependency with no fear of problems, as it's a new config key.
Thank you!
Resolves https://github.com/twopluszero/next-images/issues/24 (even though it's already closed 😅 )
I don't want to force my team into putting SVGs into one specific folder. I like the simplicity of
next-images
for most image types, but I'm using SVGR for.svg
file types. This lets me exclude SVGs fromnext-image
's concern, but still place SVG files wherever I please.Alternative
If this isn't ideal for the library author, I could also do a non-breaking change where
exclude
can be an array of the possible file types, and construct the regex in a similar fashion. In other words, ifArray.isArray(nextConfig.excludes)
, then dont add the exclude property to the loader and - instead - remove each item in theexcludes
array from thetest
regex.