@@ -49,7 +49,7 @@ const prodWebpackConfig = merge(common, {
4949 ...( hasOptimizedVideo ? { '@assets/video' : optimizedVideoDir } : { } ) ,
5050 } ,
5151 }
52- : undefined ,
52+ : { } ,
5353 // 使用文件缓存
5454 cache : { type : 'filesystem' , buildDependencies : { config : [ __filename ] } } ,
5555 // 生产调试开关:设置环境变量 DEBUG_PROD=1 可在 production 构建中输出 source-map 并关闭压缩,便于定位仅在构建后出现的问题。
@@ -103,29 +103,34 @@ const prodWebpackConfig = merge(common, {
103103 process . env . DEBUG_PROD === '1'
104104 ? [ ]
105105 : [
106- new CssMinimizerPlugin ( ) ,
106+ new CssMinimizerPlugin ( {
107+ minify : CssMinimizerPlugin . cssnanoMinify ,
108+ } ) ,
107109 new EsbuildPlugin ( {
108110 target : 'es2018' ,
109111 // 保留对象展开操作符,避免生成有问题的辅助函数
110112 keepNames : true ,
111113 } ) ,
112- new HtmlMinimizerPlugin ( ) ,
113- new ImageMinimizerPlugin ( {
114- loader : false ,
115- test : / \. ( p n g | j p e ? g | g i f | w e b p | a v i f ) $ / i,
116- minimizer : {
117- implementation : ImageMinimizerPlugin . sharpMinify ,
118- options : {
119- encodeOptions : {
120- // Safe defaults; tune per your quality/size preference.
121- jpeg : { quality : 78 , mozjpeg : true } ,
122- png : { compressionLevel : 9 , palette : true } ,
123- webp : { quality : 80 } ,
124- avif : { quality : 50 } ,
125- } ,
126- } ,
127- } ,
114+ new HtmlMinimizerPlugin ( {
115+ minify : HtmlMinimizerPlugin . htmlMinifierTerserMinify ,
128116 } ) ,
117+ // Temporarily disabled ImageMinimizerPlugin
118+ // new ImageMinimizerPlugin({
119+ // loader: false,
120+ // test: /\.(png|jpe?g|gif|webp|avif)$/i,
121+ // minimizer: {
122+ // implementation: ImageMinimizerPlugin.sharpMinify,
123+ // options: {
124+ // encodeOptions: {
125+ // // Safe defaults; tune per your quality/size preference.
126+ // jpeg: { quality: 78, mozjpeg: true },
127+ // png: { compressionLevel: 9, palette: true },
128+ // webp: { quality: 80 },
129+ // avif: { quality: 50 },
130+ // },
131+ // },
132+ // },
133+ // }),
129134 ] ,
130135 splitChunks : {
131136 chunks : 'all' ,
0 commit comments