File tree 3 files changed +3188
-191
lines changed
3 files changed +3188
-191
lines changed Original file line number Diff line number Diff line change 1
1
/** @type {import('next').NextConfig } */
2
2
const nextConfig = {
3
- // basePath: '/inbox/playground',
4
- // assetPrefix: '/inbox/playground/',
3
+ webpack ( config ) {
4
+ const fileLoaderRule = config . module . rules . find ( ( rule ) => rule . test ?. test ?. ( ".svg" ) ) ;
5
+
6
+ config . module . rules . push (
7
+ // Reapply the existing rule, but only for svg imports not ending in ".inline.svg"
8
+ {
9
+ test : / (?< ! i n l i n e ) \. s v g $ / ,
10
+ use : [
11
+ {
12
+ loader : "url-loader" ,
13
+ options : {
14
+ limit : 512 ,
15
+ publicPath : "/_next/static/svgs" ,
16
+ outputPath : "static/svgs" ,
17
+ fallback : "file-loader" ,
18
+ } ,
19
+ } ,
20
+ {
21
+ loader : "svgo-loader" ,
22
+ } ,
23
+ ] ,
24
+ } ,
25
+ // Convert all other *.svg imports to React components
26
+ {
27
+ test : / \. i n l i n e .s v g $ / i,
28
+ use : [
29
+ {
30
+ loader : "@svgr/webpack" ,
31
+ options : {
32
+ svgo : true ,
33
+ svgoConfig : {
34
+ plugins : [
35
+ {
36
+ name : "preset-default" ,
37
+ params : {
38
+ overrides : {
39
+ removeViewBox : false ,
40
+ } ,
41
+ } ,
42
+ } ,
43
+ "prefixIds" ,
44
+ ] ,
45
+ } ,
46
+ } ,
47
+ } ,
48
+ ] ,
49
+ } ,
50
+ ) ;
51
+
52
+ // Modify the file loader rule to ignore *.svg, since we have it handled now.
53
+ fileLoaderRule . exclude = / \. s v g $ / i;
54
+
55
+ return config ;
56
+ } ,
5
57
} ;
6
58
7
59
export default nextConfig ;
You can’t perform that action at this time.
0 commit comments