Skip to content

Commit 3d04261

Browse files
authored
Update next.config.ts
1 parent 1d578f7 commit 3d04261

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

next.config.ts

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,46 @@
1-
import { NextConfig } from "next";
1+
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4-
turbopack: {
5-
rules: {
6-
'*.svg': {
7-
loaders: ['@svgr/webpack'],
8-
as: '*.js',
4+
// TurboPack 설정
5+
experimental: {
6+
turbo: {
7+
rules: {
8+
'*.svg': {
9+
loaders: ['@svgr/webpack'],
10+
as: '*.js',
11+
},
912
},
10-
}
13+
},
1114
},
12-
}
15+
// webpack 설정
16+
webpack: (config) => {
17+
// @ts-expect-error 타입 에러 무시
18+
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
1319

14-
export default nextConfig;
20+
config.module.rules.push(
21+
{
22+
...fileLoaderRule,
23+
test: /\.svg$/i,
24+
resourceQuery: /url/,
25+
},
26+
{
27+
test: /\.svg$/i,
28+
issuer: fileLoaderRule.issuer,
29+
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] },
30+
use: [
31+
{
32+
loader: '@svgr/webpack',
33+
options: {
34+
typescript: true,
35+
ext: 'tsx',
36+
},
37+
},
38+
],
39+
}
40+
);
41+
fileLoaderRule.exclude = /\.svg$/i;
42+
return config;
43+
},
44+
};
45+
46+
export default nextConfig;

0 commit comments

Comments
 (0)