File tree Expand file tree Collapse file tree 1 file changed +39
-9
lines changed Expand file tree Collapse file tree 1 file changed +39
-9
lines changed Original file line number Diff line number Diff line change 1+ import type { NextConfig } from 'next' ;
12
2- const nextConfig = {
3- reactStrictMode : true ,
4- webpack : ( config : { module : { rules : { test : RegExp ; use : string [ ] ; } [ ] ; } ; } ) => {
5- config . module . rules . push ( {
6- test : / \. s v g $ / ,
7- use : [ "@svgr/webpack" ] ,
8- } ) ;
3+ const nextConfig : NextConfig = {
4+ // TurboPack 설정
5+ experimental : {
6+ turbo : {
7+ rules : {
8+ '.svg' : {
9+ loaders : [ '@svgr/webpack' ] ,
10+ as : '.js' ,
11+ } ,
12+ } ,
13+ } ,
14+ } ,
15+ // webpack 설정
16+ webpack : ( config ) => {
17+ // @ts -expect-error 타입 에러 무시
18+ const fileLoaderRule = config . module . rules . find ( ( rule ) => rule . test ?. test ?.( '.svg' ) ) ;
919
20+ config . module . rules . push (
21+ {
22+ ...fileLoaderRule ,
23+ test : / .s v g $ / i,
24+ resourceQuery : / u r l / ,
25+ } ,
26+ {
27+ test : / .s v g $ / i,
28+ issuer : fileLoaderRule . issuer ,
29+ resourceQuery : { not : [ ...fileLoaderRule . resourceQuery . not , / u r l / ] } ,
30+ use : [
31+ {
32+ loader : '@svgr/webpack' ,
33+ options : {
34+ typescript : true ,
35+ ext : 'tsx' ,
36+ } ,
37+ } ,
38+ ] ,
39+ }
40+ ) ;
41+ fileLoaderRule . exclude = / .s v g $ / i;
1042 return config ;
1143 } ,
1244} ;
1345
14- module . exports = nextConfig ;
15-
1646export default nextConfig ;
You can’t perform that action at this time.
0 commit comments