xiaoxin 1 yıl önce
ebeveyn
işleme
ac0a3120f5
2 değiştirilmiş dosya ile 43 ekleme ve 3 silme
  1. 2 3
      index.html
  2. 41 0
      vite.config.js

+ 2 - 3
index.html

@@ -2,11 +2,10 @@
 <html lang="en">
 	<head>
 		<meta charset="UTF-8" />
-		<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+		<!-- <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
 		<meta http-equiv="Cache" content="no-cache">
 		<meta http-equiv="Pragma" content="no-cache" />
-		<meta http-equiv="Expires" content="0" />
-
+		<meta http-equiv="Expires" content="0" /> -->
 
 		<script>
 			var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||

+ 41 - 0
vite.config.js

@@ -0,0 +1,41 @@
+import {
+	defineConfig
+} from 'vite';
+import uni from '@dcloudio/vite-plugin-uni';
+import path from "path";
+
+// import fs from 'fs-extra'
+
+let filePath = ''
+let Timestamp = ''
+
+//编译环境判断,判断是否H5环境
+if (process.env.UNI_PLATFORM === 'h5') {
+	filePath = 'assets/'; //打包文件存放文件夹路径
+	Timestamp = '.' + new Date().getTime(); //时间戳
+}
+
+export default defineConfig({
+	resolve: {
+		alias: {
+			"@": path.resolve(__dirname, "./src")
+		},
+	},
+	// 需要用到的插件数组
+	plugins: [
+		uni()
+	],
+	build: {
+		rollupOptions: {
+			output: {
+				// 输出重构  打包编译后的 文件目录 文件名称 【模块名称.时间戳】
+				// 入口文件名
+				entryFileNames: `${filePath}[name]${Timestamp}.js`,
+				// 块文件名
+				chunkFileNames: `${filePath}[name]${Timestamp}.js`,
+				// 资源文件名 css 图片等等
+				assetFileNames: `${filePath}[name]${Timestamp}.[ext]`
+			}
+		}
+	}
+});