From d36528bb496bb49adaad5ae6199b410d432b410c Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期四, 07 十一月 2024 17:12:11 +0800
Subject: [PATCH] 修改文件路径、配置、页面等

---
 iailab-doc-ui/wiki-ui/vite.config.js |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/iailab-doc-ui/wiki-ui/vite.config.js b/iailab-doc-ui/wiki-ui/vite.config.js
index 7116751..f78cd4a 100644
--- a/iailab-doc-ui/wiki-ui/vite.config.js
+++ b/iailab-doc-ui/wiki-ui/vite.config.js
@@ -29,13 +29,34 @@
 		},
 		extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
 	},
-	publicPath: './',
-	productionSourceMap: false,
-	pages: {
-		index: {
-			entry: 'src/main.js',
-			template: 'public/index.html',
-			filename: 'index.html',
-		},
-	}
+	build: {
+		emptyOutDir: true,
+		cssCodeSplit: false,
+		outDir: '../../iailab-doc-wiki/src/main/resources/dist',
+		rollupOptions: {
+			input: {
+				main: resolve(__dirname, 'doc-wiki.html'),
+			},
+			output: {
+				// 拆分包
+				manualChunks: (id) => {
+					if (id.includes('node_modules')) {
+						const module = id.toString().split('node_modules/')[1].split('/')[0];
+						if (['mermaid', 'highlight.js', 'katex', 'zrender', 'vant'].includes(module)) {
+							return module;
+						}
+						if (module === '@vue') return 'vue';
+						if (module === '@wangeditor') return 'wangeditor';
+						if (module.indexOf('markmap') === 0) return 'markmap';
+						if (module.indexOf('markdown') === 0) return 'markdown';
+						// 不可拆分:echarts、element-plus
+						if (!['echarts', 'element-plus'].includes(module)) {
+							return 'vendor';
+						}
+					}
+				},
+				assetFileNames: 'assets/[name].[hash].[ext]',
+			}
+		}
+	},
 });

--
Gitblit v1.9.3