Skip to content

Commit 1cfba36

Browse files
authored
Merge pull request #518 from BeAPI/fix/vulnerabilities
Réduction des vulnérabilités npm (outillage de build)
2 parents 66b1cc2 + 6c9248c commit 1cfba36

4 files changed

Lines changed: 389 additions & 2934 deletions

File tree

‎config/svgo.config.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ module.exports = {
22
plugins: [
33
{
44
name: 'preset-default',
5-
params: {
6-
overrides: {
7-
// Disable a plugin included by default that you don't want (false)
8-
removeViewBox: false,
9-
},
10-
},
5+
},
6+
{
7+
name: 'removeViewBox',
8+
active: false,
119
},
1210
// Plugins that are not in the "preset-default" and that you want to activate
1311
'removeTitle',

‎config/webpack.common.js‎

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,43 @@ module.exports = {
1515
optimization: {
1616
minimizer: [
1717
new ImageMinimizerPlugin({
18-
minimizer: {
19-
implementation: ImageMinimizerPlugin.imageminMinify,
20-
options: {
21-
plugins: [
22-
['gifsicle', { interlaced: true }],
23-
['jpegtran', { progressive: true }],
24-
['optipng', { optimizationLevel: 5 }],
25-
['svgo', svgoconfig],
26-
],
18+
minimizer: [
19+
{
20+
implementation: ImageMinimizerPlugin.sharpMinify,
21+
filter: (source, sourcePath) => !/\.svg$/i.test(sourcePath),
22+
options: {
23+
encodeOptions: {
24+
jpeg: {
25+
quality: 100,
26+
progressive: true,
27+
},
28+
jpg: {
29+
quality: 100,
30+
progressive: true,
31+
},
32+
png: {
33+
compressionLevel: 9,
34+
},
35+
gif: {},
36+
webp: {
37+
lossless: true,
38+
},
39+
avif: {
40+
lossless: true,
41+
},
42+
},
43+
},
2744
},
28-
},
45+
{
46+
implementation: ImageMinimizerPlugin.svgoMinify,
47+
options: {
48+
encodeOptions: {
49+
multipass: true,
50+
...svgoconfig,
51+
},
52+
},
53+
},
54+
],
2955
}),
3056
new TerserPlugin({
3157
parallel: true,

0 commit comments

Comments
 (0)