@@ -6,29 +6,45 @@ const nextConfig: NextConfig = {
6
6
7
7
webpack ( config ) {
8
8
// Grab the existing rule that handles SVG imports
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- const fileLoaderRule = config . module . rules . find ( ( rule : any ) =>
11
- rule . test ?. test ?.( ".svg" )
12
- ) ;
13
-
14
- config . module . rules . push (
15
- // Reapply the existing rule, but only for svg imports ending in ?url
16
- {
17
- ...fileLoaderRule ,
18
- test : / \. s v g $ / i,
19
- resourceQuery : / u r l / , // *.svg?url
9
+ // const fileLoaderRule = config.module.rules.find((rule) =>
10
+ // rule.test?.test?.(".svg")
11
+ // );
12
+
13
+ // config.module.rules.push(
14
+ // // Reapply the existing rule, but only for svg imports ending in ?url
15
+ // {
16
+ // ...fileLoaderRule,
17
+ // test: /\.svg$/i,
18
+ // resourceQuery: /url/, // *.svg?url
19
+ // },
20
+ // // Convert all other *.svg imports to React components
21
+ // {
22
+ // test: /\.svg$/i,
23
+ // issuer: fileLoaderRule.issuer,
24
+ // resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
25
+ // use: ["@svgr/webpack"],
26
+ // }
27
+ // );
28
+
29
+ // // Modify the file loader rule to ignore *.svg, since we have it handled now.
30
+ // fileLoaderRule.exclude = /\.svg$/i;
31
+
32
+ // return config;
33
+
34
+ config . module ?. rules . push ( {
35
+ test : / \. s v g $ / ,
36
+ issuer : {
37
+ and : [ / \. ( j s | t s | j s x | t s x ) $ / ] ,
20
38
} ,
21
- // Convert all other *.svg imports to React components
22
- {
23
- test : / \. s v g $ / i,
24
- issuer : fileLoaderRule . issuer ,
25
- resourceQuery : { not : [ ...fileLoaderRule . resourceQuery . not , / u r l / ] } , // exclude if *.svg?url
26
- use : [ "@svgr/webpack" ] ,
27
- }
28
- ) ;
29
-
30
- // Modify the file loader rule to ignore *.svg, since we have it handled now.
31
- fileLoaderRule . exclude = / \. s v g $ / i;
39
+ use : [
40
+ {
41
+ loader : "@svgr/webpack" ,
42
+ options : {
43
+ // здесь вы можете указать настройки для svgr, если необходимо
44
+ } ,
45
+ } ,
46
+ ] ,
47
+ } ) ;
32
48
33
49
return config ;
34
50
} ,
0 commit comments