-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
38 lines (36 loc) · 959 Bytes
/
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
import { fileURLToPath } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import ElementPlus from 'unplugin-element-plus/vite'
import { compress } from './plugins/compress'
export default defineConfig(async ({ mode }) => {
return {
plugins: [vue(), vueJsx(), ElementPlus({}), mode === 'production' && compress && compress()],
server: {
open: true,
port: 3003
},
build: {
rollupOptions: {
output: {
entryFileNames: `assets/js/[name].[hash].js`,
chunkFileNames: `assets/js/[name].[hash].js`,
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]',
manualChunks: {
vue: ['vue'],
'vue-router': ['vue-router'],
pinia: ['pinia'],
axios: ['axios'],
'element-plus': ['element-plus']
}
}
}
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
}
})