-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
Copy pathvite.config.ts
68 lines (67 loc) · 1.75 KB
/
vite.config.ts
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
63
64
65
66
67
68
import {resolve} from 'path';
import {defineConfig, splitVendorChunkPlugin} from 'vite';
import vue from '@vitejs/plugin-vue';
import dynamicImport from 'vite-plugin-dynamic-import';
import {visualizer} from 'rollup-plugin-visualizer';
import externalGlobals from 'rollup-plugin-external-globals';
import {externalizeDeps} from 'vite-plugin-externalize-deps';
export default defineConfig({
build: {
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) {
if (id.includes('@fortawesome')) return '@fortawesome';
if (id.includes('element-plus')) return 'element-plus';
if (id.includes('zrender')) return 'zrender';
if (id.includes('echarts')) return 'echarts';
if (id.includes('codemirror')) return 'codemirror';
if (id.includes('atom-material-icons')) return 'atom-material-icons';
if (id.includes('crawlab-ui')) return 'crawlab-ui';;
return 'vendor.[hash]';
}
}
},
external: [
// 'codemirror',
// 'echarts',
],
plugins: [
// @ts-ignore
// externalGlobals({
// // codemirror: 'CodeMirror',
// echarts: 'echarts',
// })
],
}
},
resolve: {
dedupe: ['vue', 'element-plus', 'codemirror'],
alias: [
{find: '@', replacement: resolve(__dirname, 'src')},
],
extensions: [
'.js',
'.ts',
'.jsx',
'.tsx',
'.json',
'.vue',
'.scss',
]
},
plugins: [
vue(),
dynamicImport(),
// splitVendorChunkPlugin(),
// externalizeDeps(),
// @ts-ignore
visualizer({
open: true,
// open: false,
}),
],
server: {
cors: true,
},
});