Browse Source

更改打包配置

huangbin 4 years ago
parent
commit
64edc71c31
1 changed files with 17 additions and 11 deletions
  1. 17 11
      vue.config.js

+ 17 - 11
vue.config.js

@@ -1,5 +1,6 @@
 const path = require('path');
-// const UglifyPlugin = require('uglifyjs-webpack-plugin');
+const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
+
 module.exports = {
 	// 基本路径
 	/* 部署生产环境和开发环境下的URL:可对当前环境进行区分,baseUrl 从 Vue CLI 3.3 起已弃用,要使用publicPath */
@@ -43,16 +44,21 @@ module.exports = {
 					}
 				},
 				minimizer: [
-					// new UglifyPlugin({
-					// 	uglifyOptions: {
-					// 		compress: {
-					// 			warnings: false,
-					// 			drop_console: true, // console
-					// 			drop_debugger: false,
-					// 			pure_funcs: [ 'console.log' ] // 移除console
-					// 		}
-					// 	}
-					// })
+					new UglifyJsPlugin({
+						uglifyOptions: {
+							// 删除注释
+							output: {
+								comments: false
+							},
+							// 删除console debugger 删除警告
+							compress: {
+								warnings: false,
+								drop_console: true, //console
+								drop_debugger: false,
+								pure_funcs: [ 'console.log' ] //移除console
+							}
+						}
+					})
 				]
 			};
 			Object.assign(config, {