Skip to content

Cannot override the default minimizerOptions.plugins, I can only add new plugins #30

Open
@FreekVR

Description

I was trying to override the default plugins in my project like so from nuxt.config.js;

[...]
imagemin: {
  mimizerOptions: {
    plugins: [
      [ 'gifsicle', { interlaced: false} ],
      [ 'jpegtran', { progressive: false} ],
      [ 'optipng', { optimizationLevel: 9 } ],
    ]
  }
}

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 the options)

const util = require('util')
console.log(util.inspect(options, false, null, true /* enable colors */))

Given the config from my project, this debug code outputs the following;

  minimizerOptions: {
    plugins: [
      [ 'gifsicle', { interlaced: true } ],
      [ 'jpegtran', { progressive: true } ],
      [ 'optipng', { optimizationLevel: 5 } ],
      [
        'svgo',
        { plugins: [ { removeViewBox: false } ] }
      ],
      [ 'gifsicle', { interlaced: false} ],
      [ 'jpegtran', { progressive: false} ],
      [ 'optipng', { optimizationLevel: 9 } ],

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 :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions