-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
129 lines (126 loc) · 3.64 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { defineConfig } from 'vite';
import { dependencies } from './package.json';
import reactRefresh from '@vitejs/plugin-react-refresh';
import { md } from './plugins/md';
const reactSvgPlugin = require('vite-plugin-react-svg');
import { visualizer } from 'rollup-plugin-visualizer';
const chunk2 = ['@codemirror/autocomplete', '@codemirror/highlight', '@codemirror/lint', '@codemirror/language', '@codemirror/state', '@d3-charts/ts-graph', '@y0c/react-datepicker', 'better-babel-generator', '@codemirror/view', 'codemirror-promql', '@codemirror/basic-setup']
const chunk3 = ['react-ace',]
const chunk1 = ['react', 'react-router-dom', 'react-dom', 'moment', '@ant-design/icons', 'umi-request', 'lodash', 'react-grid-layout', 'd3', 'ahooks', 'color']
const antdChunk = ['antd']
function renderChunks(deps: Record<string, string>) {
let chunks = {};
Object.keys(deps).forEach((key) => {
if (chunk1.includes(key) || chunk2.includes(key) || chunk3.includes(key)) return;
chunks[key] = [key];
});
return chunks;
}
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
md(),
reactRefresh(),
reactSvgPlugin({ defaultExport: 'component' }),
// visualizer()
],
define: {},
resolve: {
alias: [
{
find: '@/store/eventWallInterface',
replacement: '/src/Packages/EventWall/interface',
},
{
find: '@/services/outfire',
replacement: '/src/Packages/Outfire/services/outfire',
},
{
find: '@/pages/outfire',
replacement: '/src/Packages/Outfire/pages',
},
{
find: '@',
replacement: '/src',
},
],
// extensions:['.js', '.ts', '.jsx', '.tsx', '.json']
},
server: {
proxy: {
// 字符串简写写法
// '/foo': 'http://localhost:4567/foo',
// 选项写法
// '/api': {
// target: 'http://10.86.76.13:8085',
// changeOrigin: true,
// },
'/api/n9e': {
target: 'http://116.85.46.86:18000',
changeOrigin: true,
},
'/filters': {
target: 'http://10.85.128.137',
changeOrigin: true,
},
'/integrations': {
target: 'http://10.85.128.137',
changeOrigin: true,
},
'/alerts': {
target: 'http://10.85.128.137',
changeOrigin: true,
},
'/changes': {
target: 'http://10.85.128.137',
changeOrigin: true,
},
'/dimension/api/v1': {
target: 'http://10.166.53.215:8089',
changeOrigin: true,
},
'/v1/api/fireplate': {
target: 'http://172.20.70.60:8010',
changeOrigin: true,
},
// 正则表达式写法
// '^/fallback/.*': {
// target: 'http://jsonplaceholder.typicode.com',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/fallback/, '')
// }
},
},
build: {
outDir: 'pub',
chunkSizeWarningLimit: 650,
rollupOptions: {
output:{
manualChunks: {
vendor: chunk1,
vendor1: chunk2,
vendor2: chunk3,
antdChunk: antdChunk
},
}
},
},
css: {
preprocessorOptions: {
less: {
additionalData: `@import "/src/global.variable.less";`,
javascriptEnabled: true,
modifyVars: {
'font-size-base': '12px',
'color-base': '#333',
'form-item-margin-bottom': '18px',
'font-family':
'verdana, Microsoft YaHei, Consolas, Deja Vu Sans Mono, Bitstream Vera Sans Mono',
'text-color': '#333',
'menu-dark-bg': '#2C3D5E',
'menu-dark-inline-submenu-bg': '#2C3D5E',
},
},
},
},
});