From 7672a5fbe4395e6cf002d683b70c486d667f9b28 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 22 Sep 2021 15:12:38 +0200 Subject: [PATCH] Rollback svgo to 9.0.0 while https://github.com/webpack-contrib/image-minimizer-webpack-plugin/issues/237 is not fixed --- package.json | 2 +- webpack.config.js | 40 +++++++++++++++++++++++++++------------- yarn.lock | 16 ++++++++-------- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 614ca48..fd705bc 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "imagemin-gifsicle": "^7.0.0", "imagemin-mozjpeg": "^9.0.0", "imagemin-pngquant": "^9.0.2", - "imagemin-svgo": "^10.0.0", + "imagemin-svgo": "^9.0.0", "mini-css-extract-plugin": "^2.1.0", "sass": "^1.32.12", "sass-loader": "^12.1.0", diff --git a/webpack.config.js b/webpack.config.js index 3a46e7d..3f25d9c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin"); +const { extendDefaultPlugins } = require("svgo"); const CopyWebpackPlugin = require('copy-webpack-plugin'); const dev = process.env.NODE_ENV === 'development'; @@ -93,21 +94,34 @@ const config = { [ "svgo", { - plugins: { - name: 'preset-default', - params: { - overrides: { - removeViewBox: { - active: false, - }, - addAttributesToSVGElement: { - params: { - attributes: [{xmlns: "http://www.w3.org/2000/svg"}], - }, - }, + plugins: extendDefaultPlugins([ + { + name: "removeViewBox", + active: false, + }, + { + name: "addAttributesToSVGElement", + params: { + attributes: [{ xmlns: "http://www.w3.org/2000/svg" }], }, }, - }, + ]), + //TODO for imagemin-svgo ^10.0.0 when https://github.com/webpack-contrib/image-minimizer-webpack-plugin/issues/237 is fixed + // plugins: { + // name: 'preset-default', + // params: { + // overrides: { + // removeViewBox: { + // active: false, + // }, + // addAttributesToSVGElement: { + // params: { + // attributes: [{ xmlns: "http://www.w3.org/2000/svg" }], + // }, + // }, + // }, + // }, + // }, }, ], ], diff --git a/yarn.lock b/yarn.lock index b811afb..442e98c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3535,13 +3535,13 @@ imagemin-pngquant@^9.0.2: ow "^0.17.0" pngquant-bin "^6.0.0" -imagemin-svgo@^10.0.0: - version "10.0.0" - resolved "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-10.0.0.tgz#0cc0c5636dc707ae96c580836c79922601da9b34" - integrity sha512-nuikUDlf8u81V25ckHrWE8l7fECNx403EU3a3qrSO8H4ipBSEL3QlOgrBqZ1SJQ1lsIzJbBKwXvsrVGGO6Hj2g== +imagemin-svgo@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-9.0.0.tgz#749370804608917a67d4ff590f07a87756aec006" + integrity sha512-uNgXpKHd99C0WODkrJ8OO/3zW3qjgS4pW7hcuII0RcHN3tnKxDjJWcitdVC/TZyfIqSricU8WfrHn26bdSW62g== dependencies: - is-svg "^4.3.1" - svgo "^2.5.0" + is-svg "^4.2.1" + svgo "^2.1.0" imagemin@^7.0.1: version "7.0.1" @@ -3772,7 +3772,7 @@ is-stream@^2.0.0: resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-svg@^4.3.1: +is-svg@^4.2.1: version "4.3.1" resolved "https://registry.npmjs.org/is-svg/-/is-svg-4.3.1.tgz#8c63ec8c67c8c7f0a8de0a71c8c7d58eccf4406b" integrity sha512-h2CGs+yPUyvkgTJQS9cJzo9lYK06WgRiXUqBBHtglSzVKAuH4/oWsqk7LGfbSa1hGk9QcZ0SyQtVggvBA8LZXA== @@ -5497,7 +5497,7 @@ supports-color@^8.0.0, supports-color@^8.1.0: dependencies: has-flag "^4.0.0" -svgo@^2.3.1, svgo@^2.5.0: +svgo@^2.1.0, svgo@^2.3.1: version "2.6.1" resolved "https://registry.npmjs.org/svgo/-/svgo-2.6.1.tgz#60b613937e0081028cffc2369090e366b08f1f0e" integrity sha512-SDo274ymyG1jJ3HtCr3hkfwS8NqWdF0fMr6xPlrJ5y2QMofsQxIEFWgR1epwb197teKGgnZbzozxvJyIeJpE2Q==