@@ -3,12 +3,12 @@ const path = require('path');
3
3
function resolve ( dir ) {
4
4
return path . join ( __dirname , dir ) ;
5
5
}
6
- const BundleAnalyzerPlugin = require ( 'webpack-bundle-analyzer' ) . BundleAnalyzerPlugin ;
7
- const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
8
- const CssMinimizerPlugin = require ( "css-minimizer-webpack-plugin" ) ;
9
- const CompressionWebpackPlugin = require ( 'compression-webpack-plugin' ) ;
10
- const ProgressBarPlugin = require ( 'progress-bar-webpack-plugin' ) ;
11
- const productionGzipExtensions = [ 'js' , 'css' , 'html' ]
6
+ // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
7
+ // const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
8
+ // const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
9
+ // const CompressionWebpackPlugin = require('compression-webpack-plugin');
10
+ // const ProgressBarPlugin = require('progress-bar-webpack-plugin');
11
+ // const productionGzipExtensions = ['js', 'css', 'html']
12
12
13
13
module . exports = {
14
14
publicPath : process . env . NODE_ENV === 'production'
@@ -18,15 +18,15 @@ module.exports = {
18
18
lintOnSave : true ,
19
19
configureWebpack : {
20
20
plugins : [
21
- new ProgressBarPlugin ( ) ,
22
- new BundleAnalyzerPlugin ( ) ,
23
- new CompressionWebpackPlugin ( {
24
- filename : '[path].gz[query]' ,
25
- algorithm : 'gzip' ,
26
- test : new RegExp ( '\\.(' + productionGzipExtensions . join ( '|' ) + ')$' , ) ,
27
- threshold : 10240 , //仅处理大于此大小的资产。以字节为单位。
28
- minRatio : 0.8 ,
29
- } ) ,
21
+ // new ProgressBarPlugin(),
22
+ // new BundleAnalyzerPlugin(),
23
+ // new CompressionWebpackPlugin({
24
+ // filename: '[path].gz[query]',
25
+ // algorithm: 'gzip',
26
+ // test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$',),
27
+ // threshold: 10240,//仅处理大于此大小的资产。以字节为单位。
28
+ // minRatio: 0.8,
29
+ // }),
30
30
] ,
31
31
optimization : {
32
32
// splitChunks: {
@@ -58,34 +58,34 @@ module.exports = {
58
58
// },
59
59
// }
60
60
// },
61
- minimizer : [ new UglifyJsPlugin (
62
- {
63
- uglifyOptions : {
64
- compress : {
65
- reduce_vars : true , // 把使用多次的静态值自动定义为变量
66
- drop_debugger : true , // 删除所有的debugger语句
67
- drop_console : true , // 删除所有的console语句
68
- } ,
69
- parallel : true , // 允许并发
70
- cache : true , // 开启缓存
71
- output : {
72
- beautify : false // 使输出的代码尽可能紧凑
73
- }
74
- } ,
75
- }
76
- ) ,
77
- new CssMinimizerPlugin ( {
78
- parallel : true , // 多并发执行
79
- minimizerOptions : {
80
- preset : [
81
- "default" ,
82
- {
83
- discardComments : { removeAll : true } , //移除所有注释
84
- } ,
85
- ] ,
86
- } ,
87
- } ) ] ,
88
-
61
+ // minimizer: [
62
+ // new UglifyJsPlugin(
63
+ // {
64
+ // uglifyOptions : {
65
+ // compress: {
66
+ // reduce_vars : true,// 把使用多次的静态值自动定义为变量
67
+ // drop_debugger : true,// 删除所有的debugger语句
68
+ // drop_console: true,// 删除所有的console语句
69
+ // },
70
+ // parallel : true, // 允许并发
71
+ // cache: true, // 开启缓存
72
+ // output: {
73
+ // beautify: false // 使输出的代码尽可能紧凑
74
+ // }
75
+ // },
76
+ // }
77
+ // ),
78
+ // new CssMinimizerPlugin({
79
+ // parallel: true,// 多并发执行
80
+ // minimizerOptions: {
81
+ // preset: [
82
+ // "default",
83
+ // {
84
+ // discardComments: { removeAll: true },//移除所有注释
85
+ // } ,
86
+ // ] ,
87
+ // } ,
88
+ // })],
89
89
} ,
90
90
} ,
91
91
chainWebpack : ( config ) => {
0 commit comments