File tree Expand file tree Collapse file tree 2 files changed +619
-31
lines changed
Expand file tree Collapse file tree 2 files changed +619
-31
lines changed Original file line number Diff line number Diff line change 1+ import withBundleAnalyzer from '@next/bundle-analyzer' ;
2+ import TerserPlugin from 'terser-webpack-plugin' ;
3+
4+ const mode = process . env . NODE_ENV || 'development' ;
5+
16/** @type {import('next').NextConfig } */
27const nextConfig = {
38 transpilePackages : [ '@workspace/ui' ] ,
49 images : {
5- // eslint-disable-next-line no-undef
610 domains : [ process . env . NEXT_PUBLIC_S3_BUCKET_NAME || 'default-domain.com' ] ,
711 } ,
8- generateBuildId : async ( ) => {
9- return 'my-fixed-build-id' ;
12+ webpack : ( config , { isServer } ) => {
13+ if ( ! isServer && mode === 'production' ) {
14+ // 커스텀 splitChunks 설정
15+ config . optimization . splitChunks = {
16+ chunks : 'all' ,
17+ minSize : 20000 ,
18+ maxSize : 0 ,
19+ minChunks : 1 ,
20+ maxAsyncRequests : 30 ,
21+ maxInitialRequests : 30 ,
22+ automaticNameDelimiter : '~' ,
23+ cacheGroups : {
24+ reactVendors : {
25+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] ( r e a c t | r e a c t - d o m ) [ \\ / ] / ,
26+ name : 'react-vendors' ,
27+ chunks : 'all' ,
28+ priority : 20 ,
29+ } ,
30+ vendors : {
31+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ,
32+ name : 'vendors' ,
33+ chunks : 'all' ,
34+ priority : - 10 ,
35+ } ,
36+ default : {
37+ minChunks : 2 ,
38+ priority : - 20 ,
39+ reuseExistingChunk : true ,
40+ } ,
41+ } ,
42+ } ;
43+
44+ config . optimization . minimizer = [
45+ new TerserPlugin ( {
46+ terserOptions : {
47+ compress : {
48+ drop_console : true ,
49+ } ,
50+ } ,
51+ } ) ,
52+ ] ;
53+ }
54+ return config ;
1055 } ,
1156} ;
1257
13- export default nextConfig ;
58+ export default withBundleAnalyzer ( nextConfig ) ;
You can’t perform that action at this time.
0 commit comments