Skip to content

Commit 1b93fe0

Browse files
authored
Remove unused @svgr/webpack support (#47488)
Everything that has been using it has been removed: Jetpack had one block using it for an icon that was replaced when switching to block.json, while Forms replaced all their uses because wp-build doesn't support svgr. Meanwhile, `@svgr/webpack` seems to no longer be being actively updated upstream and is still on an old version of svgo.
1 parent 3fc6cdb commit 1b93fe0

14 files changed

Lines changed: 21 additions & 283 deletions

File tree

pnpm-lock.yaml

Lines changed: 0 additions & 221 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ minimumReleaseAgeExclude:
3030
- '@automattic/*'
3131
- '@woocommerce/*'
3232
- '@wordpress/*'
33-
# Renovate security update: svgo@4.0.1
34-
- svgo@4.0.1
3533
trustPolicy: no-downgrade
3634
trustPolicyExclude:
3735
# https://github.com/paulmillr/chokidar/issues/1440
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Significance: patch
2+
Type: removed
3+
Comment: Remove unused `@svgr/webpack` support.
4+
5+

projects/js-packages/webpack-config/src/webpack/file-rule.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const FileRule = ( options = {} ) => {
2121
'i'
2222
),
2323
...type,
24-
// Allow loading svg files as components, rather than a url, by appending `?component` to the import.
25-
resourceQuery: { not: [ /component/ ] },
2624
generator: {
2725
filename: options.filename || 'images/[name]-[contenthash][ext]',
2826
},
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Significance: patch
2+
Type: removed
3+
Comment: Remove unused `@svgr/webpack` support.
4+
5+

projects/packages/forms/declarations.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { ConnectionScriptData } from '@automattic/jetpack-connection';
22

33
declare module '*.png';
44
declare module '*.svg';
5-
declare module '*.svg?component';
65
declare module '*.svg?raw';
76
declare module '*.jpeg';
87
declare module '*.jpg';

projects/packages/forms/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102
"@automattic/remove-asset-webpack-plugin": "workspace:*",
103103
"@babel/core": "7.29.0",
104104
"@babel/runtime": "7.28.6",
105-
"@svgr/webpack": "8.1.0",
106105
"@tanstack/react-router": "^1.139.12",
107106
"@testing-library/dom": "10.4.1",
108107
"@testing-library/react": "^16.3.0",

projects/packages/forms/tools/webpack.config.blocks.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,25 +84,17 @@ const sharedWebpackConfig = {
8484
],
8585
} ),
8686

87-
// Allow importing .svg files as React components via `?component` query.
88-
{
89-
test: /\.svg$/i,
90-
issuer: /\.[jt]sx?$/,
91-
resourceQuery: /component/,
92-
use: [ '@svgr/webpack' ],
93-
},
94-
9587
// Allow importing .svg files as raw HTML strings via `?raw` query.
9688
{
9789
test: /\.svg$/i,
9890
resourceQuery: /raw/,
9991
type: 'asset/source',
10092
},
10193

102-
// Handle images (exclude ?component and ?raw SVG imports).
94+
// Handle images (exclude ?raw SVG imports).
10395
{
10496
...jetpackWebpackConfig.FileRule(),
105-
resourceQuery: { not: [ /component/, /raw/ ] },
97+
resourceQuery: { not: [ /raw/ ] },
10698
},
10799
],
108100
},

0 commit comments

Comments
 (0)