Преглед изворни кода

feat: 打包配置中自动剔除日志语句, 增加禁止html缓存的代码

yanglzh пре 1 година
родитељ
комит
0f519ef5e8
2 измењених фајлова са 10 додато и 4 уклоњено
  1. 8 3
      index.html
  2. 2 1
      vite.config.ts

+ 8 - 3
index.html

@@ -1,9 +1,14 @@
 <!DOCTYPE html>
 <html lang="zh-CN">
 <head>
-	<meta charset="utf-8" />
-	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
-	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+	<meta charset="utf-8">
+	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+	<meta name="renderer" content="webkit">
+	<meta http-equiv="Expires" content="0" />
+	<meta http-equiv="pragram" content="no-cache">
+	<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate">
+
+	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0" />
 	<link rel="icon" href="/favicon.ico" />
 	<title></title>
 </head>

+ 2 - 1
vite.config.ts

@@ -19,7 +19,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
 			vue(),
 			viteCompression({
 				threshold: 1024 * 20, // 对大于 20k 的文件进行压缩
-	      // filter: /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i, // 需要压缩的文件
+				// filter: /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i, // 需要压缩的文件
 				algorithm: 'gzip', // 压缩方式
 				ext: 'gz', // 后缀名
 				deleteOriginFile: false, // 压缩后是否删除压缩源文件
@@ -61,6 +61,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
 					},
 				},
 			},
+			minify: 'terser', // 使用terser进行压缩
 			terserOptions: {
 				compress: {
 					drop_console: true,