Skip to content

Commit 80593de

Browse files
cedric07cursoragent
andcommitted
docs(build): clarify svgoMinify filter behavior
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 07419a0 commit 80593de

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎config/webpack.common.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ module.exports = {
4444
},
4545
{
4646
implementation: ImageMinimizerPlugin.svgoMinify,
47+
// Return true to run SVGO on this asset, false to leave it unchanged.
48+
// sourcePath is the webpack compilation asset name (e.g. icons/sprite.svg).
4749
filter: (source, sourcePath) => {
50+
// Only SVG assets go through SVGO (raster images use sharpMinify above).
4851
if (!/\.svg$/i.test(sourcePath)) {
4952
return false
5053
}
5154

52-
// svg-sprite-loader extract publicPath is `icons/` — prod SVGO
53-
// removes unused <symbol> entries and empties sprite sheets.
55+
// Skip extracted sprite sheets under icons/ (svg-sprite-loader publicPath).
56+
// Those files only hold <symbol> defs; SVGO treats them as unused and
57+
// strips them, which empties the sprite and breaks #icon-* references.
5458
if (/(?:^|[/\\])icons[/\\]/i.test(sourcePath)) {
5559
return false
5660
}

0 commit comments

Comments
 (0)