Skip to content

Commit f3f5510

Browse files
authored
Update next.config.ts
1 parent 9050cae commit f3f5510

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

next.config.ts

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
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: /\.svg$/,
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: /.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;
1042
return config;
1143
},
1244
};
1345

14-
module.exports = nextConfig;
15-
1646
export default nextConfig;

0 commit comments

Comments
 (0)