Open FreekVR opened 3 years ago
Hi, There is a way to trick it, use a function:
[...]
imagemin: {
mimizerOptions: {
plugins: () => [
[ 'gifsicle', { interlaced: false} ],
[ 'jpegtran', { progressive: false} ],
[ 'optipng', { optimizationLevel: 9 } ],
]
}
}
Otherwise it just concatenates arrays.
This should be documented, but it's the default behaviour of https://github.com/unjs/defu which is used to merge configs.
I was trying to override the default plugins in my project like so from
nuxt.config.js
;However, I was having issues with these changes not applying and it appears to be the case that custom imagemin plugins are getting pushed to the defaults, instead of overriding them. I was able to verify this by adding the following debug code in
dist/module.js
line 103 (right after defining theoptions
)Given the config from my project, this debug code outputs the following;
I would expect that I would be able to override or remove the default plugins and their options, but as it stands, it only appears I can add new ones? Or if I'm missing something here please let me know where I went wrong :)