Skip to content

Commit b518ada

Browse files
cedric07cursoragent
andcommitted
fix(build): skip prod SVGO on extracted sprite sheets under dist/icons
Production SVGO on merged sprite SVGs collapses symbols; icons are already optimized via svgo-loader at compile time. Matches BBT sprite workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent ce7f5f0 commit b518ada

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎config/webpack.common.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,18 @@ module.exports = {
4444
},
4545
{
4646
implementation: ImageMinimizerPlugin.svgoMinify,
47-
filter: (source, sourcePath) => /\.svg$/i.test(sourcePath),
47+
filter: (source, sourcePath) => {
48+
if (!/\.svg$/i.test(sourcePath)) {
49+
return false
50+
}
51+
52+
// svg-sprite-loader extract: dist/icons/{sprite}.svg — prod SVGO breaks <symbol> entries.
53+
if (/[/\\]icons[/\\][^/\\]+\.svg$/i.test(sourcePath)) {
54+
return false
55+
}
56+
57+
return true
58+
},
4859
options: {
4960
encodeOptions: {
5061
multipass: true,

0 commit comments

Comments
 (0)