1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| const { resolve } = require('path')
| import {defineConfig} from 'vite'
| import vue from '@vitejs/plugin-vue'
|
| export default defineConfig({
| server: {
| host: '0.0.0.0',
| port: 3000,
| open: true,
| proxy: {
| ['/proxy-api']: {
| target: 'http://localhost:8083',
| changeOrigin: true,
| rewrite: (path) => path.replace(`/proxy-api`, ''),
| }
| },
| disableHostCheck: true
| },
| base: '',
| plugins: [
| vue(),
| ],
| resolve: {
| alias: {
| // 设置路径 这里resolve和join可自行选用
| '~': resolve(__dirname, './'),
| // 设置别名
| '@': resolve(__dirname, './src')
| },
| extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
| },
| 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]',
| }
| }
| },
| });
|
|