This repository was archived by the owner on Aug 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
115 lines (110 loc) · 2.54 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
import { fileURLToPath, URL } from 'node:url'
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import svgLoader from 'vite-svg-loader'
import viteCompression from 'vite-plugin-compression'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Icons from 'unplugin-icons/vite'
import IconsResolver from 'unplugin-icons/resolver'
import versionUpdatePlugin from './plugins/versionUpdatePlugin'
const pathSrc = path.resolve(__dirname, 'src')
const now = new Date().getTime()
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('micro-app')
}
}
}),
vueJsx(),
svgLoader(),
viteCompression({
threshold: 10240,
filter: /\.(js|mjs|json|css|html|ttf)$/i,
algorithm: 'gzip',
ext: '.gz'
}),
versionUpdatePlugin({
version: now
}),
AutoImport({
imports: ['vue'],
resolvers: [
ElementPlusResolver(),
IconsResolver({
prefix: 'Icon'
})
],
dts: path.resolve(pathSrc, 'auto-imports.d.ts')
}),
Components({
resolvers: [
ElementPlusResolver(),
IconsResolver({
enabledCollections: ['ep']
})
],
dts: path.resolve(pathSrc, 'components.d.ts')
}),
Icons({
autoInstall: true,
compiler: 'vue3'
})
],
base: '/',
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@api': fileURLToPath(new URL('./src/api', import.meta.url))
}
},
test: {
server: {
deps: {
inline: ['element-plus']
}
}
},
server: {
host: '0.0.0.0',
port: 10101,
proxy: {
'/nsas-api': {
target: 'http://139.159.243.90:800',
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/nsas-api/, '')
}
}
},
preview: {
host: '0.0.0.0',
port: 10101,
proxy: {
'/nsas-api': {
target: 'http://139.159.243.90:800',
ws: true,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/nsas-api/, '')
}
}
},
build: {
sourcemap: true,
cssCodeSplit: false,
rollupOptions: {
output: {
manualChunks: {
lodash: ['lodash']
}
}
}
}
})