cascornelissen / svg-spritemap-webpack-plugin

SVG spritemap plugin for webpack
MIT License
207 stars 49 forks source link

Updating from 4.2.0 to 4.3.0: SVGO plugin not doing anything anymore #178

Closed dsine-de closed 2 years ago

dsine-de commented 2 years ago

Description I updated from 4.2.0 to 4.3.0 with the following webpack configuration:

new SVGSpritemapPlugin('client/svg/**/*.svg', {
    sprite: {
        prefix: 'icon-',
        generate: {title: false}
    },
    output: {
        svgo: {
            plugins: [
                'preset-default',
                {
                    name: 'removeAttrs',
                    params: {attrs: 'fill'}
                }
            ]
        }
    }
}),

The removal of fill attributes worked in v4.2.0 but after updating to 4.3.0 the attributes are still being output. According to the docs of both SVGO and svg-spritemap-webpack-plugin there shouldn't be any breaking changes which requires the configuration to be updated.

Expected behavior fill attributes should be removed like before.

Actual behavior fill attributes are included in the SVG output.

System information

  System:
    OS: Windows 10 10.0.19043
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 23.00 GB / 31.95 GB
  Binaries:
    Node: 16.8.0 - C:\Program Files\nodejs\node.EXE
    npm: 7.21.0 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    @babel/core: ^7.15.0 => 7.15.0
    @babel/eslint-parser: ^7.15.0 => 7.15.0
    @babel/plugin-syntax-top-level-await: ^7.14.5 => 7.14.5
    @babel/preset-env: ^7.15.0 => 7.15.0
    @vue/compiler-sfc: ^3.2.6 => 3.2.6
    agora-access-token: ^2.0.4 => 2.0.4
    agora-rtc-sdk-ng: ^4.6.3 => 4.6.3
    argon2: ^0.28.2 => 0.28.2
    babel-loader: ^8.2.2 => 8.2.2
    body-parser: ^1.19.0 => 1.19.0
    bufferutil: ^4.0.3 => 4.0.3
    celebrate: ^15.0.0 => 15.0.0
    clean-webpack-plugin: ^3.0.0 => 3.0.0
    connect-history-api-fallback: ^1.6.0 => 1.6.0
    cross-env: ^7.0.3 => 7.0.3
    css-loader: ^6.2.0 => 6.2.0
    ejs: ^3.1.6 => 3.1.6
    eslint: ^7.32.0 => 7.32.0
    eslint-plugin-vue: 7.17.0 => 7.17.0
    eslint-webpack-plugin: 3.0.1 => 3.0.1
    express: ^4.17.1 => 4.17.1
    generate-password: ^1.6.1 => 1.6.1
    gsap: ^3.7.1 => 3.7.1
    hex-rgb: ^5.0.0 => 5.0.0
    html-webpack-plugin: ^5.3.2 => 5.3.2
    less: 4.1.1 => 4.1.1
    less-loader: 10.0.1 => 10.0.1
    mini-css-extract-plugin: 2.2.0 => 2.2.0
    mongodb: ^4.1.1 => 4.1.1
    morgan: ^1.10.0 => 1.10.0
    multer: ^1.4.3 => 1.4.3
    nodemailer: ^6.6.3 => 6.6.3
    object-to-formdata: ^4.1.0 => 4.1.0
    pm2: ^5.1.1 => 5.1.1
    postcss: ^8.3.6 => 8.3.6
    postcss-loader: ^6.1.1 => 6.1.1
    serve-favicon: ^2.5.0 => 2.5.0
    short-uuid: ^4.2.0 => 4.2.0
    style-loader: ^3.2.1 => 3.2.1
    stylelint: ^13.13.1 => 13.13.1
    stylelint-config-standard: ^22.0.0 => 22.0.0
    svg-spritemap-webpack-plugin: ^4.3.0 => 4.3.0
    utf-8-validate: ^5.0.5 => 5.0.5
    vue: ^3.2.6 => 3.2.6
    vue-i18n: ^9.1.4 => 9.1.4
    vue-loader: ^16.5.0 => 16.5.0
    vue-router: ^4.0.10 => 4.0.10
    webpack: ^5.51.1 => 5.51.1
    webpack-cli: ^4.8.0 => 4.8.0
    webpack-dev-middleware: ^5.0.0 => 5.0.0
    webpack-hot-middleware: ^2.25.0 => 2.25.0
    ws: ^8.2.1 => 8.2.1
cascornelissen commented 2 years ago

Thanks for the bug report, looks like I didn't end up checking the non-default SVGO plugins. This should be fixed in 35fab37, could you verify that it's working for you by installing the plugin directly from GitHub before I create a patch release?

npm install cascornelissen/svg-spritemap-webpack-plugin#master
dsine-de commented 2 years ago

@cascornelissen Yes, this seems to fix it!

cascornelissen commented 2 years ago

Awesome, thanks for reporting back. I've just published 4.3.1 which includes this fix 🚀