-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
52 lines (51 loc) · 1.24 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
import { UserConfig, ConfigEnv, loadEnv } from 'vite'
import path from 'path'
import XEUtils from 'xe-utils'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import { createHtmlPlugin } from 'vite-plugin-html'
import externalGlobals from 'rollup-plugin-external-globals'
import zipPack from 'vite-plugin-zip-pack'
// https://vitejs.dev/config/
export default ({ mode }: ConfigEnv): UserConfig => {
const env = loadEnv(mode, process.cwd(), 'VITE_')
return {
base: '/admin-template/',
plugins: [
vue(),
vueJsx(),
createHtmlPlugin({
inject: {
data: {
VITE_APP_BUILD_TIME: XEUtils.toDateString(new Date(), 'yyyy-MM-dd HH:mm:ss'),
...env
}
}
}),
zipPack({
outDir: './'
})
],
resolve: {
alias: {
'@': path.join(__dirname, './src')
},
extensions: ['.js', '.vue', '.json', '.ts', '.tsx']
},
server: {
port: 8084
},
build: {
rollupOptions: {
// 不打包依赖
external: ['echarts'],
plugins: [
// 不打包依赖映射的对象
externalGlobals({
echarts: 'echarts'
})
]
}
}
}
}