-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.mjs
More file actions
53 lines (45 loc) · 1.56 KB
/
next.config.mjs
File metadata and controls
53 lines (45 loc) · 1.56 KB
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
46
47
48
49
50
51
52
53
/** @type {import("next").NextConfig} */
import withBundleAnalyzer from "@next/bundle-analyzer";
import TerserPlugin from "terser-webpack-plugin";
// PWA 설정 추가
const nextConfig = {
distDir: "./.next",
poweredByHeader: false,
productionBrowserSourceMaps: false,
// 이미지 최적화 관련 설정 추가
images: {
// SVG 이미지 형식을 허용 (보안 위험이 있으므로 'dangerous' 접두어 사용)
dangerouslyAllowSVG: true,
// 이미지가 인라인 표시되지 않고 다운로드되도록 설정
contentDispositionType: "attachment",
// SVG 파일에 대한 보안 정책 설정 (XSS 공격 방지)
contentSecurityPolicy: "default-src 'self'; script-src 'none'; sandbox;",
domains: [
"poomasi-prod.s3.ap-northeast-2.amazonaws.com",
"avatars.githubusercontent.com",
],
},
// webpack을 compiler 밖으로 이동
webpack: (config) => {
config.optimization.minimizer.push(
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true, // console.log 제거
passes: 3, // 압축 최적화를 3번 반복 (압축률 증가)
},
mangle: true, // 변수 및 함수명을 난독화하여 크기 감소
format: {
comments: false, // 모든 주석 제거 (파일 크기 줄이기)
},
},
extractComments: false, // 주석을 별도 파일로 분리 X (파일 크기 줄이기)
parallel: true, // 병렬 실행 활성화 (빌드 속도 최적화)
})
);
return config;
},
};
export default withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
})(nextConfig);