-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.mjs
45 lines (40 loc) · 1.26 KB
/
next.config.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/** @type {import('next').NextConfig} */
import { createVanillaExtractPlugin } from "@vanilla-extract/next-plugin";
const withVanillaExtract = createVanillaExtractPlugin();
const nextConfig = {
output: "standalone",
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'algohubbucket.s3.ap-northeast-2.amazonaws.com'
}
]
},
reactStrictMode: false,
webpack(config) {
// SVG imports를 처리하는 기존 규칙 가져오기
const fileLoaderRule = config.module.rules.find((rule) =>
rule.test?.test?.(".svg")
);
config.module.rules.push(
// svg imports 중 ?url로 끝나는 것에 대해서만 기존 규칙을 재적용
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
// *.svg imports를 React 컴포넌트로 변환
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: ["@svgr/webpack"],
}
);
// 처리가 완료된 *.svg를 무시하도록 파일 로더 규칙을 수정
fileLoaderRule.exclude = /\.svg$/i;
return config;
},
};
export default withVanillaExtract(nextConfig);