This commit is contained in:
Alice Gaudon 2021-09-22 15:12:38 +02:00
parent de6d4b7e7f
commit 7672a5fbe4
3 changed files with 36 additions and 22 deletions

View File

@ -46,7 +46,7 @@
"imagemin-gifsicle": "^7.0.0", "imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0", "imagemin-mozjpeg": "^9.0.0",
"imagemin-pngquant": "^9.0.2", "imagemin-pngquant": "^9.0.2",
"imagemin-svgo": "^10.0.0", "imagemin-svgo": "^9.0.0",
"mini-css-extract-plugin": "^2.1.0", "mini-css-extract-plugin": "^2.1.0",
"sass": "^1.32.12", "sass": "^1.32.12",
"sass-loader": "^12.1.0", "sass-loader": "^12.1.0",

View File

@ -1,6 +1,7 @@
const path = require('path'); const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin"); const ImageMinimizerPlugin = require("image-minimizer-webpack-plugin");
const { extendDefaultPlugins } = require("svgo");
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const dev = process.env.NODE_ENV === 'development'; const dev = process.env.NODE_ENV === 'development';
@ -93,21 +94,34 @@ const config = {
[ [
"svgo", "svgo",
{ {
plugins: { plugins: extendDefaultPlugins([
name: 'preset-default', {
params: { name: "removeViewBox",
overrides: {
removeViewBox: {
active: false, active: false,
}, },
addAttributesToSVGElement: { {
name: "addAttributesToSVGElement",
params: { params: {
attributes: [{xmlns: "http://www.w3.org/2000/svg"}], 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" }],
// },
// },
// },
// },
// },
}, },
], ],
], ],

View File

@ -3535,13 +3535,13 @@ imagemin-pngquant@^9.0.2:
ow "^0.17.0" ow "^0.17.0"
pngquant-bin "^6.0.0" pngquant-bin "^6.0.0"
imagemin-svgo@^10.0.0: imagemin-svgo@^9.0.0:
version "10.0.0" version "9.0.0"
resolved "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-10.0.0.tgz#0cc0c5636dc707ae96c580836c79922601da9b34" resolved "https://registry.npmjs.org/imagemin-svgo/-/imagemin-svgo-9.0.0.tgz#749370804608917a67d4ff590f07a87756aec006"
integrity sha512-nuikUDlf8u81V25ckHrWE8l7fECNx403EU3a3qrSO8H4ipBSEL3QlOgrBqZ1SJQ1lsIzJbBKwXvsrVGGO6Hj2g== integrity sha512-uNgXpKHd99C0WODkrJ8OO/3zW3qjgS4pW7hcuII0RcHN3tnKxDjJWcitdVC/TZyfIqSricU8WfrHn26bdSW62g==
dependencies: dependencies:
is-svg "^4.3.1" is-svg "^4.2.1"
svgo "^2.5.0" svgo "^2.1.0"
imagemin@^7.0.1: imagemin@^7.0.1:
version "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" resolved "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==
is-svg@^4.3.1: is-svg@^4.2.1:
version "4.3.1" version "4.3.1"
resolved "https://registry.npmjs.org/is-svg/-/is-svg-4.3.1.tgz#8c63ec8c67c8c7f0a8de0a71c8c7d58eccf4406b" resolved "https://registry.npmjs.org/is-svg/-/is-svg-4.3.1.tgz#8c63ec8c67c8c7f0a8de0a71c8c7d58eccf4406b"
integrity sha512-h2CGs+yPUyvkgTJQS9cJzo9lYK06WgRiXUqBBHtglSzVKAuH4/oWsqk7LGfbSa1hGk9QcZ0SyQtVggvBA8LZXA== integrity sha512-h2CGs+yPUyvkgTJQS9cJzo9lYK06WgRiXUqBBHtglSzVKAuH4/oWsqk7LGfbSa1hGk9QcZ0SyQtVggvBA8LZXA==
@ -5497,7 +5497,7 @@ supports-color@^8.0.0, supports-color@^8.1.0:
dependencies: dependencies:
has-flag "^4.0.0" 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" version "2.6.1"
resolved "https://registry.npmjs.org/svgo/-/svgo-2.6.1.tgz#60b613937e0081028cffc2369090e366b08f1f0e" resolved "https://registry.npmjs.org/svgo/-/svgo-2.6.1.tgz#60b613937e0081028cffc2369090e366b08f1f0e"
integrity sha512-SDo274ymyG1jJ3HtCr3hkfwS8NqWdF0fMr6xPlrJ5y2QMofsQxIEFWgR1epwb197teKGgnZbzozxvJyIeJpE2Q== integrity sha512-SDo274ymyG1jJ3HtCr3hkfwS8NqWdF0fMr6xPlrJ5y2QMofsQxIEFWgR1epwb197teKGgnZbzozxvJyIeJpE2Q==